X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2FInstance.java;h=ece87186b7021a11118d8c42ed324c51a8374333;hb=aa8b74a318769354c5cb512ead428beb372503a2;hp=c265861aefb3f2b8c3e7e324c216ded7cad1682d;hpb=9f705f1afe91f215836e405c2a09cbbf926298cd;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index c265861..ece8718 100644 --- a/src/be/nikiroo/fanfix/Instance.java +++ b/src/be/nikiroo/fanfix/Instance.java @@ -16,6 +16,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.TempFiles; import be.nikiroo.utils.TraceHandler; import be.nikiroo.utils.resources.Bundles; @@ -35,6 +36,7 @@ public class Instance { private static File remoteDir; private static String configDir; private static TraceHandler tracer; + private static TempFiles tempFiles; static { // Before we can configure it: @@ -47,7 +49,7 @@ public class Instance { } // Most of the rest is dependent upon this: - createConfigs(configDir, true); + createConfigs(configDir, false); // update tracer: boolean debug = Instance.getConfig() @@ -99,6 +101,12 @@ public class Instance { + coverDir)); coverDir = null; } + + try { + tempFiles = new TempFiles("fanfix"); + } catch (IOException e) { + tracer.error(new IOException("Cannot create temporary directory", e)); + } } /** @@ -304,6 +312,17 @@ public class Instance { } } + /** + * The facility to use temporary files in this program. + *

+ * MUST be closed at end of program. + * + * @return the facility + */ + public static TempFiles getTempFiles() { + return tempFiles; + } + /** * The configuration directory (will check, in order of preference, * {@link Bundles#getDirectory()}, the system properties, the environment @@ -336,7 +355,7 @@ public class Instance { * @param configDir * the directory where to find the configuration files * @param refresh - * TRUE to refresh the configuration files from the default + * TRUE to reset the configuration files from the default * included ones */ private static void createConfigs(String configDir, boolean refresh) { @@ -390,7 +409,7 @@ public class Instance { if (remoteLib == null || remoteLib.trim().isEmpty()) { String libDir = System.getProperty("fanfix.libdir"); if (libDir == null || libDir.isEmpty()) { - config.getString(Config.LIBRARY_DIR); + libDir = config.getString(Config.LIBRARY_DIR); } try { lib = new LocalLibrary(getFile(libDir));