<commit_before>package com.wizzardo.http.framework.template;


import com.wizzardo.http.framework.Environment;
import com.wizzardo.http.framework.Holders;
import com.wizzardo.http.framework.di.Injectable;
import com.wizzardo.tools.collections.flow.Filter;
import com.wizzardo.tools.io.FileTools;
import com.wizzardo.tools.io.IOTools;
import com.wizzardo.tools.io.ZipTools;
import com.wizzardo.tools.misc.Consumer;
import com.wizzardo.tools.misc.Unchecked;

import java.io.*;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

/**
 * @author: moxa
 * Date: 11/23/12
 */
@Injectable
public class LocalResourcesTools implements ResourceTools {

    private List<String> classpath = new ArrayList<>();
    private List<File> resourcesDirs = new ArrayList<>();
    protected List<Filter<String>> classpathFilters = new ArrayList<>();

    {
        ClassLoader cl = ClassLoader.getSystemClassLoader();

        URL[] urls = ((URLClassLoader) cl).getURLs();
        for (URL url : urls) {
            classpath.add(url.getFile());
        }

        File src = new File("src");
        if (src.exists() && src.isDirectory()) {
            addResourcesDir(src.getAbsoluteFile().getParentFile());
        }

        File jarFile = new File(LocalResourcesTools.class.getProtectionDomain().getCodeSource().getLocation().getPath());
        if (jarFile.isFile()) {

            File outDir = new File(Unchecked.call(() -> File.createTempFile("", "")).getParentFile(), jarFile.getName() + "_unzipped");
            if (outDir.exists())
                FileTools.deleteRecursive(outDir);

            ZipTools.unzip(jarFile, outDir, entry -> entry.getName().startsWith("public"));
            addResourcesDir(outDir);
        }<commit_msg>fix for temp file<commit_after>package com.wizzardo.http.framework.template;


import com.wizzardo.http.framework.Environment;
import com.wizzardo.http.framework.Holders;
import com.wizzardo.http.framework.di.Injectable;
import com.wizzardo.tools.collections.flow.Filter;
import com.wizzardo.tools.io.FileTools;
import com.wizzardo.tools.io.IOTools;
import com.wizzardo.tools.io.ZipTools;
import com.wizzardo.tools.misc.Consumer;
import com.wizzardo.tools.misc.Unchecked;

import java.io.*;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

/**
 * @author: moxa
 * Date: 11/23/12
 */
@Injectable
public class LocalResourcesTools implements ResourceTools {

    private List<String> classpath = new ArrayList<>();
    private List<File> resourcesDirs = new ArrayList<>();
    protected List<Filter<String>> classpathFilters = new ArrayList<>();

    {
        ClassLoader cl = ClassLoader.getSystemClassLoader();

        URL[] urls = ((URLClassLoader) cl).getURLs();
        for (URL url : urls) {
            classpath.add(url.getFile());
        }

        File src = new File("src");
        if (src.exists() && src.isDirectory()) {
            addResourcesDir(src.getAbsoluteFile().getParentFile());
        }

        File jarFile = new File(LocalResourcesTools.class.getProtectionDomain().getCodeSource().getLocation().getPath());
        if (jarFile.isFile()) {

            File outDir = new File(Unchecked.call(() -> File.createTempFile("---", null)).getParentFile(), jarFile.getName() + "_unzipped");
            if (outDir.exists())
                FileTools.deleteRecursive(outDir);

            ZipTools.unzip(jarFile, outDir, entry -> entry.getName().startsWith("public"));
            addResourcesDir(outDir);
        }
{'fraction_non_alphanumeric': 0.13750329902348904, 'fraction_numerical': 0.003167062549485352, 'mean_word_length': 3.5280764635603346, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, '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': '5631162', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1127, 'n_words': 209}