Default configuration dir: $HOME/.fanfix
authorNiki Roo <niki@nikiroo.be>
Sun, 12 Feb 2017 11:36:16 +0000 (12:36 +0100)
committerNiki Roo <niki@nikiroo.be>
Sun, 12 Feb 2017 11:36:16 +0000 (12:36 +0100)
nikiroo-utils was updated to 0.9.2 for this, too, with
basically just a few lines of code deleted and a package renaming

libs/nikiroo-utils-0.9.1-sources.jar [deleted file]
libs/nikiroo-utils-0.9.2-sources.jar [new file with mode: 0644]
src/be/nikiroo/fanfix/Instance.java
src/be/nikiroo/fanfix/Main.java
src/be/nikiroo/fanfix/bundles/ConfigBundle.java
src/be/nikiroo/fanfix/bundles/StringId.java
src/be/nikiroo/fanfix/bundles/StringIdBundle.java
src/be/nikiroo/fanfix/bundles/Target.java
src/be/nikiroo/fanfix/reader/BasicReader.java

diff --git a/libs/nikiroo-utils-0.9.1-sources.jar b/libs/nikiroo-utils-0.9.1-sources.jar
deleted file mode 100644 (file)
index 7a9468a..0000000
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 (file)
index 0000000..82863ab
Binary files /dev/null and b/libs/nikiroo-utils-0.9.2-sources.jar differ
index 71f42dd74103a68efc9cc6e78296d6d6ed0491ca..ea66aec0d1b3c7fcedc65dfc31366e29a9b67708 100644 (file)
@@ -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 {
index bb9aee5a5bdd8e4bd1e99125b1c2424145e7a23d..406e8a2fb4b9fb0ae1ebfa1a3adbc9203f419888 100644 (file)
@@ -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;
index 4f2303ecff0696df5e81179c4328c076b494d07e..9bf9dc69c07fa87286ad03c092d420839d9bff8b 100644 (file)
@@ -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.
index 124003cd05ef76d481af81853905bcb7552cfe3a..014d6f086df560bd4682a74c0503481c95fd55a7 100644 (file)
@@ -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
index 3456b67e08ada71e1a2a25774478d1e3736878e2..e94c05b448eb3ba3231035f9999ec4dbb22d40b7 100644 (file)
@@ -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.
index 212f8a7080502af2469edd9e5b15c7a61c649500..aace98a9f7ca2aa7d1db8a078a50af1a6e2dd906 100644 (file)
@@ -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
index 34133e40c232008075e16f3fb653317eea03c424..13e1599849128f28187c477c09c5fb673f886140 100644 (file)
@@ -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);
                        }