Small fixes:
[nikiroo-utils.git] / src / be / nikiroo / fanfix / Instance.java
index ed22f6217b13fd57bb28953f188c59f98f2321a4..ece87186b7021a11118d8c42ed324c51a8374333 100644 (file)
@@ -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:
@@ -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.
+        * <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