<commit_before>package org.andidev.webdriverextension.internal.junitrunner;

import org.andidev.webdriverextension.internal.utils.OsUtils;
import org.andidev.webdriverextension.junitrunner.annotations.DriverPaths;
import org.apache.commons.lang3.StringUtils;

public class DriverPathLoader {

    private static String CHROME_DRIVER_PROPERTY_KEY = "webdriver.chrome.driver";
    private static String INTERNET_EXPLORER_DRIVER_PROPERTY_KEY = "webdriver.ie.driver";
    private static String ALTERNATIVE_INTERNET_EXPLORER_DRIVER_PROPERTY_KEY = "webdriver.internetexplorer.driver";

    public static void loadDriverPaths(DriverPaths driverPaths) {
        setChromeDriverDriverPath(driverPaths != null ? driverPaths.chrome() : "");
        setInternetExplorerDriverPath(driverPaths != null ? driverPaths.internetExplorer() : "");
    }

    private static void setChromeDriverDriverPath(String path) {
        if (System.getProperty(CHROME_DRIVER_PROPERTY_KEY) != null) {
            return;
        }
        if (StringUtils.isNotBlank(path)) {
            System.setProperty(CHROME_DRIVER_PROPERTY_KEY, path);
            return;
        }
        System.setProperty(CHROME_DRIVER_PROPERTY_KEY, getChromeDriverDefaultPath());
    }

    private static void setInternetExplorerDriverPath(String path) {
        if (System.getProperty(INTERNET_EXPLORER_DRIVER_PROPERTY_KEY) != null) {
            return;
        }
        if (System.getProperty(ALTERNATIVE_INTERNET_EXPLORER_DRIVER_PROPERTY_KEY) != null) {
            System.setProperty(INTERNET_EXPLORER_DRIVER_PROPERTY_KEY, System.getProperty(ALTERNATIVE_INTERNET_EXPLORER_DRIVER_PROPERTY_KEY));
            return;
        }
        if (StringUtils.isNotBlank(path)) {
            System.setProperty(INTERNET_EXPLORER_DRIVER_PROPERTY_KEY, path);
            return;
        }
        System.setProperty(INTERNET_EXPLORER_DRIVER_PROPERTY_KEY, getInternetExplorerDriverDefaultPath());
    }

    private static String getChromeDriverDefaultPath() {
        if (OsUtils.isWindows()) {
            return getDriverPath() + "/chromedriver.exe";
        } else {
            return getDriverPath() + "/chromedriver";
        }
    }

    private static String getInternetExplorerDriverDefaultPath() {
        return getDriverPath() + "/internetexplorerdriver.exe";
    }

    private static String getDriverPath() {
        if (OsUtils.isWindows()) {
            return OsUtils.getUserHomePath() + "/drivers";
        } else {
            return OsUtils.getUserHomePath() + "/.drivers";
        }
    }
}
<commit_msg>Changed default driver path to project-folder/drivers<commit_after>package org.andidev.webdriverextension.internal.junitrunner;

import org.andidev.webdriverextension.internal.WebDriverExtensionException;
import org.andidev.webdriverextension.internal.utils.OsUtils;
import org.andidev.webdriverextension.junitrunner.annotations.DriverPaths;
import org.apache.commons.lang3.StringUtils;

public class DriverPathLoader {

    private static String CHROME_DRIVER_PROPERTY_KEY = "webdriver.chrome.driver";
    private static String INTERNET_EXPLORER_DRIVER_PROPERTY_KEY = "webdriver.ie.driver";
    private static String ALTERNATIVE_INTERNET_EXPLORER_DRIVER_PROPERTY_KEY = "webdriver.internetexplorer.driver";

    public static void loadDriverPaths(DriverPaths driverPaths) {
        setChromeDriverDriverPath(driverPaths != null ? driverPaths.chrome() : "");
        setInternetExplorerDriverPath(driverPaths != null ? driverPaths.internetExplorer() : "");
    }

    private static void setChromeDriverDriverPath(String path) {
        if (System.getProperty(CHROME_DRIVER_PROPERTY_KEY) != null) {
            return;
        }
        if (StringUtils.isNotBlank(path)) {
            System.setProperty(CHROME_DRIVER_PROPERTY_KEY, path);
            return;
        }
        System.setProperty(CHROME_DRIVER_PROPERTY_KEY, getChromeDriverDefaultPath());
    }

    private static void setInternetExplorerDriverPath(String path) {
        if (System.getProperty(INTERNET_EXPLORER_DRIVER_PROPERTY_KEY) != null) {
            return;
        }
        if (System.getProperty(ALTERNATIVE_INTERNET_EXPLORER_DRIVER_PROPERTY_KEY) != null) {
            System.setProperty(INTERNET_EXPLORER_DRIVER_PROPERTY_KEY, System.getProperty(ALTERNATIVE_INTERNET_EXPLORER_DRIVER_PROPERTY_KEY));
            return;
        }
        if (StringUtils.isNotBlank(path)) {
            System.setProperty(INTERNET_EXPLORER_DRIVER_PROPERTY_KEY, path);
            return;
        }
        System.setProperty(INTERNET_EXPLORER_DRIVER_PROPERTY_KEY, getInternetExplorerDriverDefaultPath());
    }

    private static String getChromeDriverDefaultPath() {
        if (OsUtils.isWindows()) {
            return "drivers/windows/chromedriver.exe";
        } else if (OsUtils.isMac()) {
            return "drivers/mac/chromedriver";
        } else if (OsUtils.isLinux()) {
            return "drivers/linux/chromedriver";
        }
        throw new WebDriverExtensionException("You are using an unsuported platform. Platform = " + OsUtils.getOsName());
    }

    private static String getInternetExplorerDriverDefaultPath() {
        return "drivers/windows/internetexplorerdriver.exe";
    }
}

{'fraction_non_alphanumeric': 0.08736379277384822, 'fraction_numerical': 0.0003823360734085261, 'mean_word_length': 3.5064599483204133, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4944603', 'n_tokens_mistral': 1559, 'n_tokens_neox': 1550, 'n_words': 224}