Skip to content

Commit 2663f5e

Browse files
committed
Use Forge resource finder for directories instead of MF finder
1 parent 213bcd1 commit 2663f5e

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

forge/src/main/java/org/embeddedt/modernfix/forge/classloading/ModernFixResourceFinder.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,12 @@ private static Iterable<Path> getRootPathForLocator(IModLocator locator, ModFile
9292
}
9393

9494
public static Enumeration<URL> findAllURLsForResource(String input) {
95-
// CachedResourcePath normalizes already but we need to strip trailing slash if any
96-
// TODO move logic to FileUtil.normalize()
97-
int lastIndex = input.length();
98-
boolean strip = false;
99-
while(lastIndex > 1) {
100-
char c = input.charAt(lastIndex - 1);
101-
if (c == '/' || c == '\\') {
102-
lastIndex--;
103-
strip = true;
104-
} else
105-
break;
95+
// fallback to Forge impl for any paths ending in a slash
96+
char endChar = input.length() > 0 ? input.charAt(input.length() - 1) : '/';
97+
if(endChar == '/' || endChar == '\\') {
98+
return LoadingModList.get().findAllURLsForResource(input);
10699
}
107-
if(strip)
108-
input = input.substring(0, lastIndex);
100+
// CachedResourcePath normalizes already
109101
Collection<String> urlList = urlsForClass.get(new CachedResourcePath(input));
110102
if(!urlList.isEmpty()) {
111103
String pathInput = FileUtil.normalize(input);

0 commit comments

Comments
 (0)