Skip to content

Commit 691308a

Browse files
authored
fix: java 8 returns a slash at th end in a Path#toString on folders, must be removed (#13)
1 parent 1ece6fd commit 691308a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/mcsr/speedrunapi/mixin/resourceloader/DefaultClientResourcePackMixin.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.nio.file.Files;
1919
import java.nio.file.Path;
2020
import java.util.*;
21+
import java.util.regex.Matcher;
2122
import java.util.stream.Stream;
2223

2324
@Mixin(DefaultClientResourcePack.class)
@@ -44,7 +45,7 @@ public abstract class DefaultClientResourcePackMixin {
4445

4546
Set<String> namespaces = new HashSet<>();
4647
try (Stream<Path> stream = Files.list(assets)) {
47-
stream.filter(Files::isDirectory).forEach(path -> namespaces.add(path.getFileName().toString()));
48+
stream.filter(Files::isDirectory).forEach(path -> namespaces.add(path.getFileName().toString().replaceAll(Matcher.quoteReplacement("[/\\]"), "")));
4849
} catch (IOException e) {
4950
SpeedrunAPI.LOGGER.error("SpeedrunAPI failed to check resources for mod: {}", mod.getMetadata().getId());
5051
}

0 commit comments

Comments
 (0)