From: Niki Roo Date: Sun, 12 Feb 2017 11:36:16 +0000 (+0100) Subject: Default configuration dir: $HOME/.fanfix X-Git-Tag: fanfix-swing-0.0.1~12^2~551 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=948637bc8cc1dcf76f783870cf46f71794a9805d;p=fanfix-swing.git Default configuration dir: $HOME/.fanfix nikiroo-utils was updated to 0.9.2 for this, too, with basically just a few lines of code deleted and a package renaming --- diff --git a/libs/nikiroo-utils-0.9.1-sources.jar b/libs/nikiroo-utils-0.9.1-sources.jar deleted file mode 100644 index 7a9468a6..00000000 Binary files a/libs/nikiroo-utils-0.9.1-sources.jar and /dev/null differ diff --git a/libs/nikiroo-utils-0.9.2-sources.jar b/libs/nikiroo-utils-0.9.2-sources.jar new file mode 100644 index 00000000..82863ab7 Binary files /dev/null and b/libs/nikiroo-utils-0.9.2-sources.jar differ diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index 71f42dd7..ea66aec0 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 { diff --git a/src/be/nikiroo/fanfix/Main.java b/src/be/nikiroo/fanfix/Main.java index bb9aee5a..406e8a2f 100644 --- a/src/be/nikiroo/fanfix/Main.java +++ b/src/be/nikiroo/fanfix/Main.java @@ -62,7 +62,7 @@ public class Main { String typeString = null; String chapString = null; String target = null; - MainAction action = null; + MainAction action = MainAction.HELP; Boolean plusInfo = null; boolean noMoreActions = false; diff --git a/src/be/nikiroo/fanfix/bundles/ConfigBundle.java b/src/be/nikiroo/fanfix/bundles/ConfigBundle.java index 4f2303ec..9bf9dc69 100644 --- a/src/be/nikiroo/fanfix/bundles/ConfigBundle.java +++ b/src/be/nikiroo/fanfix/bundles/ConfigBundle.java @@ -3,7 +3,7 @@ package be.nikiroo.fanfix.bundles; import java.io.File; import java.io.IOException; -import be.nikiroo.utils.resources.bundles.Bundle; +import be.nikiroo.utils.resources.Bundle; /** * This class manages the configuration of the application. diff --git a/src/be/nikiroo/fanfix/bundles/StringId.java b/src/be/nikiroo/fanfix/bundles/StringId.java index 124003cd..014d6f08 100644 --- a/src/be/nikiroo/fanfix/bundles/StringId.java +++ b/src/be/nikiroo/fanfix/bundles/StringId.java @@ -3,8 +3,8 @@ package be.nikiroo.fanfix.bundles; import java.io.IOException; import java.io.Writer; +import be.nikiroo.utils.resources.Bundle; import be.nikiroo.utils.resources.Meta; -import be.nikiroo.utils.resources.bundles.Bundle; /** * The {@link Enum} representing textual information to be translated to the diff --git a/src/be/nikiroo/fanfix/bundles/StringIdBundle.java b/src/be/nikiroo/fanfix/bundles/StringIdBundle.java index 3456b67e..e94c05b4 100644 --- a/src/be/nikiroo/fanfix/bundles/StringIdBundle.java +++ b/src/be/nikiroo/fanfix/bundles/StringIdBundle.java @@ -3,7 +3,7 @@ package be.nikiroo.fanfix.bundles; import java.io.File; import java.io.IOException; -import be.nikiroo.utils.resources.bundles.TransBundle; +import be.nikiroo.utils.resources.TransBundle; /** * This class manages the translation resources of the application. diff --git a/src/be/nikiroo/fanfix/bundles/Target.java b/src/be/nikiroo/fanfix/bundles/Target.java index 212f8a70..aace98a9 100644 --- a/src/be/nikiroo/fanfix/bundles/Target.java +++ b/src/be/nikiroo/fanfix/bundles/Target.java @@ -1,6 +1,6 @@ package be.nikiroo.fanfix.bundles; -import be.nikiroo.utils.resources.bundles.Bundle; +import be.nikiroo.utils.resources.Bundle; /** * The type of configuration information the associated {@link Bundle} will diff --git a/src/be/nikiroo/fanfix/reader/BasicReader.java b/src/be/nikiroo/fanfix/reader/BasicReader.java index 34133e40..13e15998 100644 --- a/src/be/nikiroo/fanfix/reader/BasicReader.java +++ b/src/be/nikiroo/fanfix/reader/BasicReader.java @@ -159,8 +159,8 @@ public abstract class BasicReader { public static BasicReader getReader() { if (defaultType != null) { switch (defaultType) { - // case LOCAL: - // return new LocalReader().setType(ReaderType.LOCAL); + //case LOCAL: + //return new LocalReader().setType(ReaderType.LOCAL); case CLI: return new CliReader().setType(ReaderType.CLI); }