package il.ac.technion.ie.experiments.Utils;

import org.apache.log4j.Logger;

import java.io.File;
import java.io.IOException;

/**
 * Created by I062070 on 10/09/2015.
 */
public class ExpFileUtils {
    static final Logger logger = Logger.getLogger(ExpFileUtils.class);

    public static File createFile(String pathToFile) {
        File outputFile = new File(pathToFile);
        if (outputFile.exists()) {
            logger.info("Output file exists. Deleting " + pathToFile);
            if (!outputFile.delete()) {
                logger.warn("Failed to delete output file");
            }
        }
        try {
            logger.info("Creating the output file");
            outputFile.createNewFile();
        } catch (IOException e) {
            logger.error("Failed to create output file", e);
        }
        return outputFile;
    }

    public static String getOutputFilePath(String fileName, String fileSuffix) {
        File runningDir = new File(System.getProperty("user.dir"));
        File parentFile = runningDir.getParentFile();
        return parentFile.getAbsolutePath() + File.separator + fileName + fileSuffix;
    }
}

@@ -39,16 +39,56 @@
 Utils;%0A%0A
+import org.apache.commons.io.FileUtils;%0A
 import o
@@ -1181,11 +1181,524 @@
 x;%0A    %7D
+%0A%0A    public static File createOutputFile(String filename) %7B%0A        File expResults = null;%0A        try %7B%0A            expResults = new File(filename);%0A            if (expResults.exists()) %7B%0A                FileUtils.forceDelete(expResults);%0A            %7D%0A            if (!expResults.createNewFile()) %7B%0A                expResults = null;%0A            %7D%0A        %7D catch (IOException e) %7B%0A            logger.error(%22Failed to create file for measurements of Experiment%22, e);%0A        %7D%0A        return expResults;%0A    %7D
 %0A%7D%0A

Add a generic method that creates an output file