修复无法正确识别模组的问题 (#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) { public @Nullable E getEntry(@NotNull String entryPath) {
Dir<E> dir = root; Dir<E> dir = root;
String fileName;
if (entryPath.indexOf('/') < 0) { if (entryPath.indexOf('/') < 0) {
fileName = entryPath; return dir.getFiles().get(entryPath);
if (fileName.isEmpty())
return root.getEntry();
} else { } else {
String[] path = entryPath.split("/"); String[] path = entryPath.split("/");
if (path.length == 0) if (path.length == 0)
@@ -88,14 +85,9 @@ public abstract class ArchiveFileTree<R, E extends ArchiveEntry> implements Clos
return null; return null;
} }
fileName = path[path.length - 1]; String fileName = path[path.length - 1];
E entry = dir.getFiles().get(fileName); return dir.getFiles().get(fileName);
if (entry != null)
return entry;
} }
Dir<E> subDir = dir.getSubDirs().get(fileName);
return subDir != null ? subDir.getEntry() : null;
} }
protected void addEntry(E entry) throws IOException { protected void addEntry(E entry) throws IOException {