public String environmentifyDirectory(String directory) {
        //todo has to be fixed for linux, will silently work,
        //is intended for windows but won't bother linux unless % are used
        Pattern pattern = Pattern.compile("%(.*?)%");
        Matcher matcher = pattern.matcher(directory);
        while (matcher.find()) {
            directory = directory.replace(matcher.group(), System.getenv(matcher.group(1)));
        }
        return directory;
    }