Skip to content

Commit 81c4980

Browse files
committed
Fix resource pack cache engine being unable to list resource stacks for files
1 parent df9d280 commit 81c4980

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

common/src/main/java/org/embeddedt/modernfix/resources/PackResourcesCacheEngine.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public PackResourcesCacheEngine(Function<PackType, Set<String>> namespacesRetrie
6060
String namespace = pair.getFirst();
6161
Path root = pair.getSecond();
6262
String[] prefix = new String[] { type.getDirectory(), namespace };
63-
try (Stream<Path> stream = Files.walk(root)) {
63+
try (Stream<Path> stream = Files.find(root, Integer.MAX_VALUE, (p, a) -> a.isRegularFile())) {
6464
stream
6565
.map(path -> root.relativize(path.toAbsolutePath()))
6666
.filter(PackResourcesCacheEngine::isValidCachedResourcePath)
@@ -154,8 +154,10 @@ public Collection<ResourceLocation> getResources(PackType type, String resourceN
154154
if((cachePath.getNameCount() - 2) > maxDepth)
155155
continue;
156156
String fullPath = cachePath.getFullPath(2);
157-
if(!fullPath.startsWith(testPath))
157+
String fullTestPath = fullPath.endsWith("/") ? fullPath : (fullPath + "/");
158+
if(!fullTestPath.startsWith(testPath)) {
158159
continue;
160+
}
159161
ResourceLocation foundResource = new ResourceLocation(resourceNamespace, fullPath);
160162
if(!filter.test(foundResource))
161163
continue;

0 commit comments

Comments
 (0)