Version 1.2.4: fixes, new "Re-download" UI option
[fanfix.git] / src / be / nikiroo / fanfix / Instance.java
index cd57efe038532e78d6983e2e2cbd410184e16884..33c65e003aeddc21a7f70e36b342b123a9e6f5ac 100644 (file)
@@ -30,11 +30,15 @@ public class Instance {
                // Most of the rest is dependent upon this:
                config = new ConfigBundle();
 
-               String configDir = System.getenv("CONFIG_DIR");
+               String configDir = System.getProperty("CONFIG_DIR");
+               if (configDir == null) {
+                       configDir = System.getenv("CONFIG_DIR");
+               }
                if (configDir == null) {
                        configDir = new File(System.getProperty("user.home"), ".fanfix")
                                        .getPath();
                }
+               
                if (configDir != null) {
                        if (!new File(configDir).exists()) {
                                new File(configDir).mkdirs();
@@ -87,20 +91,14 @@ public class Instance {
                        debug = true;
                }
 
-               if (tmp == null || readerTmp == null) {
-                       String tmpDir = System.getProperty("java.io.tmpdir");
-                       if (tmpDir != null) {
-                               if (tmp == null) {
-                                       tmp = new File(tmpDir, "fanfic-tmp");
-                               }
-                               if (readerTmp == null) {
-                                       readerTmp = new File(tmpDir, "fanfic-reader");
-                               }
-                       } else {
-                               syserr(new IOException(
-                                               "The system does not have a default temporary directory"));
-                       }
+               // Could have used: System.getProperty("java.io.tmpdir")
+               if (tmp == null) {
+                       tmp = new File(configDir, "tmp");
+               }
+               if (readerTmp == null) {
+                       readerTmp = new File(configDir, "tmp-reader");
                }
+               //
 
                if (coverDir != null && !coverDir.exists()) {
                        syserr(new IOException(