X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2FInstance.java;h=ea66aec0d1b3c7fcedc65dfc31366e29a9b67708;hp=71f42dd74103a68efc9cc6e78296d6d6ed0491ca;hb=948637bc8cc1dcf76f783870cf46f71794a9805d;hpb=7de079f11e29028d226132d84b4fef3870453599 diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index 71f42dd..ea66aec 100644 --- a/src/be/nikiroo/fanfix/Instance.java +++ b/src/be/nikiroo/fanfix/Instance.java @@ -23,7 +23,7 @@ public class Instance { private static File readerTmp; static { - // Most of the rest is dependant upon this: + // Most of the rest is dependent upon this: config = new ConfigBundle(); trans = new StringIdBundle(getLang()); @@ -64,25 +64,31 @@ public class Instance { } String configDir = System.getenv("CONFIG_DIR"); + if (configDir == null) { + configDir = new File(System.getProperty("user.home"), ".fanfix") + .getPath(); + } if (configDir != null) { - if (new File(configDir).isDirectory()) { - Bundles.setDirectory(configDir); - try { - config = new ConfigBundle(); - config.updateFile(configDir); - } catch (IOException e) { - syserr(e); - } - try { - trans = new StringIdBundle(getLang()); - trans.updateFile(configDir); - } catch (IOException e) { - syserr(e); - } + if (!new File(configDir).exists()) { + new File(configDir).mkdirs(); } else { - syserr(new IOException("Configuration directory not found: " - + configDir)); + Bundles.setDirectory(configDir); } + + try { + config = new ConfigBundle(); + config.updateFile(configDir); + } catch (IOException e) { + syserr(e); + } + try { + trans = new StringIdBundle(getLang()); + trans.updateFile(configDir); + } catch (IOException e) { + syserr(e); + } + + Bundles.setDirectory(configDir); } try {