X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2FInstance.java;h=b6849c279dd298f3b1d1f139367c613a87d9c980;hb=f83510cf13d55c8700de01ee06ae752da1d102b4;hp=b4af5e836598bdce5a5bc6d0b04b1b8297bf6aff;hpb=5bc9573be46f09ac92207e104915bd5babbd6d63;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index b4af5e8..b6849c2 100644 --- a/src/be/nikiroo/fanfix/Instance.java +++ b/src/be/nikiroo/fanfix/Instance.java @@ -17,6 +17,8 @@ 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; import be.nikiroo.utils.resources.Bundles; @@ -42,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,15 +57,13 @@ 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); @@ -70,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") @@ -404,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); } @@ -545,8 +549,11 @@ public class Instance { private static String getLang() { String lang = config.getString(Config.LANG); - if (System.getenv("LANG") != null && !System.getenv("LANG").isEmpty()) { - lang = System.getenv("LANG"); + if (lang == null || lang.isEmpty()) { + if (System.getenv("LANG") != null + && !System.getenv("LANG").isEmpty()) { + lang = System.getenv("LANG"); + } } if (lang != null && lang.isEmpty()) { @@ -564,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(); @@ -573,8 +580,10 @@ public class Instance { || "y".equals(value)) { return true; } + + return false; } - return false; + return null; } }