Skip to content

Commit 370d0ce

Browse files
authored
Forge Quilt 模组管理支持识别子文件夹 (#5196)
Close #2178 Close #5164
1 parent 6f402cd commit 370d0ce

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.jackhuang.hmcl.util.io.CompressingUtils;
2727
import org.jackhuang.hmcl.util.io.FileUtils;
2828
import org.jackhuang.hmcl.util.tree.ZipFileTree;
29-
import org.jackhuang.hmcl.util.versioning.VersionNumber;
3029
import org.jetbrains.annotations.Unmodifiable;
3130

3231
import java.io.IOException;
@@ -177,11 +176,13 @@ public void refreshMods() throws IOException {
177176

178177
analyzer = LibraryAnalyzer.analyze(getRepository().getResolvedPreservingPatchesVersion(id), null);
179178

179+
boolean supportSubfolders = analyzer.has(LibraryAnalyzer.LibraryType.FORGE)
180+
|| analyzer.has(LibraryAnalyzer.LibraryType.QUILT);
181+
180182
if (Files.isDirectory(getModsDirectory())) {
181183
try (DirectoryStream<Path> modsDirectoryStream = Files.newDirectoryStream(getModsDirectory())) {
182184
for (Path subitem : modsDirectoryStream) {
183-
if (Files.isDirectory(subitem) && VersionNumber.isIntVersionNumber(FileUtils.getName(subitem))) {
184-
// If the folder name is game version, forge will search mod in this subdirectory
185+
if (supportSubfolders && Files.isDirectory(subitem)) {
185186
try (DirectoryStream<Path> subitemDirectoryStream = Files.newDirectoryStream(subitem)) {
186187
for (Path subsubitem : subitemDirectoryStream) {
187188
addModInfo(subsubitem);

0 commit comments

Comments
 (0)