Switched to YAML config format.
[instantlauncher.git] / src / main / java / eu / svjatoslav / instantlauncher / Configuration.java
diff --git a/src/main/java/eu/svjatoslav/instantlauncher/Configuration.java b/src/main/java/eu/svjatoslav/instantlauncher/Configuration.java
deleted file mode 100755 (executable)
index 94f9de2..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-package eu.svjatoslav.instantlauncher;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Properties;
-
-public class Configuration {
-
-    private static final String KEY_ROOT_DIRECTORY = "KEY_ROOT_DIRECTORY";
-    private static final String CONFIG_FILE_NAME = ".instantlauncher";
-    private final Properties properties = new Properties();
-
-    private boolean propertiesChanged = false;
-
-    public Configuration() throws IOException {
-        initialize();
-    }
-
-    private File getPropertiesFile() {
-        return new File(System.getProperty("user.home") + "/" + CONFIG_FILE_NAME);
-    }
-
-    public File getRootDirectory() {
-
-        if (properties.containsKey(KEY_ROOT_DIRECTORY)) {
-            return new File(properties.getProperty(KEY_ROOT_DIRECTORY));
-        } else {
-            properties.put(KEY_ROOT_DIRECTORY, System.getProperty("user.home") + "/");
-            propertiesChanged = true;
-            return getRootDirectory();
-        }
-
-    }
-
-    private void initialize() throws IOException {
-
-        loadIfFileExists();
-
-        validatePropertiesFile();
-
-        if (propertiesChanged) {
-            saveFile();
-        }
-    }
-
-    private void loadIfFileExists() throws IOException {
-        final File propertiesFile = getPropertiesFile();
-
-        if (propertiesFile.exists()) {
-            final FileInputStream inStream = new FileInputStream(propertiesFile);
-            properties.load(inStream);
-            inStream.close();
-        }
-    }
-
-    private void saveFile() throws IOException {
-        properties.store(new FileOutputStream(getPropertiesFile()), "Instantlauncher configuration file.");
-    }
-
-    private void validatePropertiesFile() {
-        getRootDirectory();
-    }
-
-}