System.exit(0);
}
private static EditorConfig readEditorConfig(Messenger reporter)
{
EditorConfig cfg = null;
File cfgdir = new File(System.getProperty("user.home"), ".pipet");
File cfgfile = new File(cfgdir, "editor.cfg");
if (cfgdir.exists() || cfgdir.mkdirs())
{
if (cfgfile.canRead())
{
try
{
cfg = new EditorConfigParser().parseInputStream(new FileInputStream(cfgfile));
}
catch (IOException e)
{
reporter.warn(e.toString());
}
catch (InvalidConfigurationException e)
{
reporter.warn("While reading edtior config: "+e.getMessage());
}
}
}
if (cfg == null)
cfg = new EditorConfig();
File writetest = cfgfile.exists() ? cfgfile : cfgdir;
if (writetest.canWrite())
cfg.addChangeListener(new EditorConfigManager(cfgfile, reporter));
return cfg;
}