+ tracer.error(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
+ * and then defaults to $HOME/.fanfix).
+ *
+ * @return the config directory
+ */
+ private static String getConfigDir() {
+ String configDir = Bundles.getDirectory();
+
+ if (configDir == null) {
+ configDir = System.getProperty("CONFIG_DIR");
+ }
+
+ if (configDir == null) {
+ configDir = System.getenv("CONFIG_DIR");
+ }
+
+ if (configDir == null) {
+ configDir = new File(getHome(), ".fanfix").getPath();
+ }
+
+ return configDir;
+ }
+
+ /**
+ * Create the config variables ({@link Instance#config},
+ * {@link Instance#uiconfig}, {@link Instance#trans} and
+ * {@link Instance#transGui}).
+ *
+ * @param configDir
+ * the directory where to find the configuration files
+ * @param refresh
+ * TRUE to reset the configuration files from the default
+ * included ones
+ */
+ private static void createConfigs(String configDir, boolean refresh) {
+ if (!refresh) {
+ Bundles.setDirectory(configDir);
+ }
+
+ try {
+ config = new ConfigBundle();
+ config.updateFile(configDir);
+ } catch (IOException e) {
+ tracer.error(e);