X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2FInstance.java;h=24d67afb88cf0c98c551b8f1c6cdd82f3252f6ab;hb=51bf906d225bd14db66c9961e01c54cdaa500c54;hp=a6f6fb75125404225cf8eed459f48d7cca282294;hpb=dddfac1d036f22b694a00c029744ac0e92168a8f;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index a6f6fb7..24d67af 100644 --- a/src/be/nikiroo/fanfix/Instance.java +++ b/src/be/nikiroo/fanfix/Instance.java @@ -17,6 +17,7 @@ import be.nikiroo.fanfix.library.LocalLibrary; import be.nikiroo.fanfix.library.RemoteLibrary; import be.nikiroo.utils.Cache; import be.nikiroo.utils.IOUtils; +import be.nikiroo.utils.Image; import be.nikiroo.utils.Proxy; import be.nikiroo.utils.TempFiles; import be.nikiroo.utils.TraceHandler; @@ -43,7 +44,9 @@ public class Instance { static { // Before we can configure it: - tracer = new TraceHandler(true, checkEnv("DEBUG"), checkEnv("DEBUG")); + Boolean debug = checkEnv("DEBUG"); + boolean trace = debug != null && debug; + tracer = new TraceHandler(true, trace, trace); // config dir: configDir = getConfigDir(); @@ -53,19 +56,14 @@ public class Instance { // Most of the rest is dependent upon this: createConfigs(configDir, false); - + // Proxy support Proxy.use(Instance.getConfig().getString(Config.USE_PROXY)); // update tracer: - boolean debug = Instance.getConfig() - .getBoolean(Config.DEBUG_ERR, false); - boolean trace = Instance.getConfig().getBoolean(Config.DEBUG_TRACE, - false); - - if (checkEnv("DEBUG")) { - debug = true; - trace = true; + if (debug == null) { + debug = Instance.getConfig().getBoolean(Config.DEBUG_ERR, false); + trace = Instance.getConfig().getBoolean(Config.DEBUG_TRACE, false); } tracer = new TraceHandler(true, debug, trace); @@ -74,7 +72,8 @@ public class Instance { remoteDir = new File(configDir, "remote"); lib = createDefaultLibrary(remoteDir); - // create cache + // create cache and TMP + Image.setTemporaryFilesRoot(new File(configDir, "tmp.images")); File tmp = getFile(Config.CACHE_DIR); if (tmp == null) { // Could have used: System.getProperty("java.io.tmpdir") @@ -408,7 +407,8 @@ public class Instance { trans.deleteFile(configDir); } - if (checkEnv("NOUTF")) { + Boolean noutf = checkEnv("NOUTF"); + if (noutf != null && noutf) { trans.setUnicode(false); transGui.setUnicode(false); } @@ -571,7 +571,7 @@ public class Instance { * * @return TRUE if it is */ - private static boolean checkEnv(String key) { + private static Boolean checkEnv(String key) { String value = System.getenv(key); if (value != null) { value = value.trim().toLowerCase(); @@ -580,8 +580,10 @@ public class Instance { || "y".equals(value)) { return true; } + + return false; } - return false; + return null; } }