/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Aleksandar Cvetković
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package htsquirrel;

import java.io.File;

/**
 *
 * @author Aleksandar Cvetković <arcvetkovic@gmail.com>
 */
public class FileManagement {
    
    // get user home directory path
    public static String getHomePath() {
        return System.getProperty("user.home");
    }
    
    // get .htsquirrel directory path
    public static String getHtsPath() {
        return getHomePath() + "/.htsquirrel";
    }
    
    // get config.properties path
    public static String getConfigPath() {
        return getHtsPath() + "/config.properties";
    }
    
    // check if .htsquirrel directory exists
    public static boolean htsDirExists() {
        boolean result = false;
        File htsPath = new File(getHtsPath());
        if (htsPath.exists() & htsPath.isDirectory()) {
            result = true;
        }
        return result;
    }
    
    // check if .htsquirrel file exists
    public static boolean htsFileExists() {
        boolean result = false;
        File htsPath = new File(getHtsPath());
        if (htsPath.exists() & htsPath.isFile()) {
            result = true;
        }
        return result;
    }
    
    // check if config.properties file exists
    public static boolean configFileExists() {
        boolean result = false;
        File configPath = new File(getConfigPath());
        if (configPath.exists() & configPath.isFile()) {
            result = true;
        }
        return result;
    }
    
    // check if config.properties directory exists
    public static boolean configDirExists() {
        boolean result = false;
        File configPath = new File(getConfigPath());
        if (configPath.exists() & configPath.isDirectory()) {
            result = true;
        }
        return result;
    }
    
}

@@ -1187,16 +1187,44 @@
 io.File;
+%0Aimport java.io.IOException;
 %0A%0A/**%0A *
@@ -2931,10 +2931,1100 @@
  %7D%0A    %0A
+    // create new config.properties file%0A    public static void createNewConfig() throws IOException %7B%0A        if (htsFileExists()) %7B%0A            File htsPath = new File(getHtsPath());%0A            htsPath.delete();%0A        %7D%0A        if (!(htsDirExists())) %7B%0A            File htsPath = new File(getHtsPath());%0A            htsPath.mkdir();%0A        %7D%0A        if (configDirExists()) %7B%0A            File configPath = new File(getConfigPath());%0A            deleteDir(configPath);%0A        %7D%0A        if (configFileExists()) %7B%0A            File configPath = new File(getConfigPath());%0A            configPath.delete();%0A        %7D%0A        File configPath = new File(getConfigPath());%0A        configPath.createNewFile();%0A    %7D%0A    %0A    // delete directory%0A    private static void deleteDir(File directory) %7B%0A        File%5B%5D files = directory.listFiles();%0A        for (File file : files) %7B%0A            if (file.isDirectory()) %7B%0A                deleteDir(file);%0A                file.delete();%0A            %7D else %7B%0A                file.delete();%0A            %7D%0A        %7D%0A        directory.delete();%0A    %7D%0A    %0A
 %7D%0A

Add createNewConfig