package se.claremont.autotest.common;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * The LogFolder class maintains the test run log folder for logging purposes of test based logs,
 * html based logs, summary log, screen shots and other assets that has to do with test resources
 * being saved along a test execution.
 *
 * Created by jordam on 2016-09-05.
 */
public class LogFolder {
    public static String testRunLogFolder = null;  //Used for test case logging
    @SuppressWarnings("FieldCanBeLocal")
    private static String baseLogFolder = null;     //Read from Settings

    /**
     * Sets the values to run time values.
     *
     * @param testSetName The name of the testSet. Normally used to get test case logs in correct folder
     */
    public static void setLogFolder(String testSetName){
        if(testRunLogFolder == null){
            baseLogFolder = TestRun.settings.getValue(Settings.SettingParameters.BASE_LOG_FOLDER);
            if(!baseLogFolder.endsWith("\\")){ baseLogFolder = baseLogFolder + "\\"; }
            testRunLogFolder = baseLogFolder + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + "_" + testSetName + "\\";
        }
    }
}

@@ -32,16 +32,37 @@
 ommon;%0A%0A
+import java.io.File;%0A
 import j
@@ -1023,16 +1023,48 @@
 th(%22%5C%5C%22)
+ %7C%7C !baseLogFolder.endsWith(%22/%22)
 )%7B baseL
@@ -1142,16 +1142,75 @@
 ogFolder
+.replace(%22%5C%5C%22, File.separator).replace(%22/%22, File.separator)
  + new S
@@ -1285,20 +1285,30 @@
 tName + 
-%22%5C%5C%22
+File.separator
 ;%0A      

Fix for bad file separators for screenshots