From bfbb4b69b681ad3cd2808729c0886ca1ef666826 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 9 Jun 2026 19:36:06 -0700 Subject: [PATCH] fix different platforms having different behavior for sorting --- .../java/com/cleanroommc/groovyscript/sandbox/SandboxData.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/SandboxData.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/SandboxData.java index 0616f687b..14ff210c5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/SandboxData.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/SandboxData.java @@ -146,7 +146,6 @@ public static String getRelativePath(String path) { static Collection getSortedFilesOf(File root, Collection paths, boolean debug) { Object2IntLinkedOpenHashMap files = new Object2IntLinkedOpenHashMap<>(); - String separator = File.separatorChar == '\\' ? "\\\\" : File.separator; for (String path : paths) { File rootFile = new File(root, path); @@ -155,7 +154,7 @@ static Collection getSortedFilesOf(File root, Collection paths, bo } // if we are looking at a specific file, we don't want that to be overridden. // otherwise, we want to use the specificity based on the number of file separators. - int pathSize = StringUtils.countMatches(path, separator); + int pathSize = StringUtils.countMatches(rootFile.getPath(), File.separatorChar); try (Stream stream = Files.walk(rootFile.toPath(), debug ? FOLLOW_LINKS : NO_VISIT_OPTIONS)) { stream.filter(path1 -> isGroovyFile(path1.toString())) .map(Path::toFile)