修复无法正确识别模组的问题 (#5149)

This commit is contained in:
Glavo
2026-01-06 21:08:49 +08:00
committed by GitHub
parent 18a8556997
commit f1bd4bffb7

View File

@@ -69,11 +69,8 @@ public abstract class ArchiveFileTree<R, E extends ArchiveEntry> implements Clos
public @Nullable E getEntry(@NotNull String entryPath) {
Dir<E> dir = root;
String fileName;
if (entryPath.indexOf('/') < 0) {
fileName = entryPath;
if (fileName.isEmpty())
return root.getEntry();
return dir.getFiles().get(entryPath);
} else {
String[] path = entryPath.split("/");
if (path.length == 0)
@@ -88,14 +85,9 @@ public abstract class ArchiveFileTree<R, E extends ArchiveEntry> implements Clos
return null;
}
fileName = path[path.length - 1];
E entry = dir.getFiles().get(fileName);
if (entry != null)
return entry;
String fileName = path[path.length - 1];
return dir.getFiles().get(fileName);
}
Dir<E> subDir = dir.getSubDirs().get(fileName);
return subDir != null ? subDir.getEntry() : null;
}
protected void addEntry(E entry) throws IOException {