Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no sort of script files #270

Closed
krakel opened this issue Oct 26, 2015 · 1 comment
Closed

no sort of script files #270

krakel opened this issue Oct 26, 2015 · 1 comment

Comments

@krakel
Copy link

krakel commented Oct 26, 2015

Why do you not sort the script files. On your ScriptProviderDirectory.java you use the unsorted file list. A simple Arrays.sort(directory) could help. :) On huge modpack projects with many script gets the changes easier.

public Iterator<IScriptIterator> getScripts() {
        List<IScriptIterator> scripts = new ArrayList<IScriptIterator>();
        if (directory.exists()) {
// Arrays.sort(directory);   // a simple sort would help here
            for (File file : directory.listFiles()) {
                if (file.isDirectory()) {
                    scripts.add(new ScriptIteratorDirectory(file));
                } else if (file.getName().endsWith(".zs")) {
                    scripts.add(new ScriptIteratorSingle(file));
                } else if (file.getName().endsWith(".zip")) {
                    try {
                        scripts.add(new ScriptIteratorZip(file));
                    } catch (IOException ex) {
                        MineTweakerAPI.logError("Could not load " + file.getName() + ": " + ex.getMessage());
                    }
                }
            }
        }
        return scripts.iterator();
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants