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;
private static File remoteDir;
private static String configDir;
private static TraceHandler tracer;
+ private static TempFiles tempFiles;
static {
// Before we can configure it:
}
// Most of the rest is dependent upon this:
- createConfigs(configDir, true);
+ createConfigs(configDir, false);
// update tracer:
boolean debug = Instance.getConfig()
+ coverDir));
coverDir = null;
}
+
+ try {
+ tempFiles = new TempFiles("fanfix");
+ } catch (IOException e) {
+ tracer.error(new IOException("Cannot create temporary directory", e));
+ }
}
/**
}
}
+ /**
+ * The facility to use temporary files in this program.
+ * <p>
+ * <b>MUST</b> 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
* @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) {
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));