diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java index 9095aafcc..70e06f858 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java @@ -25,6 +25,7 @@ import org.jackhuang.hmcl.Metadata; import org.jackhuang.hmcl.download.LibraryAnalyzer; import org.jackhuang.hmcl.event.Event; import org.jackhuang.hmcl.event.EventManager; +import org.jackhuang.hmcl.mod.ModAdviser; import org.jackhuang.hmcl.mod.Modpack; import org.jackhuang.hmcl.mod.ModpackConfiguration; import org.jackhuang.hmcl.mod.ModpackProvider; @@ -172,17 +173,7 @@ public class HMCLGameRepository extends DefaultGameRepository { File srcGameDir = getRunDirectory(srcId); File dstGameDir = getRunDirectory(dstId); - List blackList = new ArrayList<>(Arrays.asList( - "regex:(.*?)\\.log", - "usernamecache.json", "usercache.json", // Minecraft - "launcher_profiles.json", "launcher.pack.lzma", // Minecraft Launcher - "backup", "pack.json", "launcher.jar", "cache", // HMCL - ".curseclient", // Curse - ".fabric", ".mixin.out", // Fabric - "jars", "logs", "versions", "assets", "libraries", "crash-reports", "NVIDIA", "AMD", "screenshots", "natives", "native", "$native", "server-resource-packs", // Minecraft - "downloads", // Curse - "asm", "backups", "TCNodeTracker", "CustomDISkins", "data", "CustomSkinLoader/caches" // Mods - )); + List blackList = new ArrayList<>(ModAdviser.MODPACK_BLACK_LIST); blackList.add(srcId + ".jar"); blackList.add(srcId + ".json"); if (!copySaves) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModAdviser.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModAdviser.java index cf16d6ca4..0b6ffc128 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModAdviser.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModAdviser.java @@ -19,6 +19,7 @@ package org.jackhuang.hmcl.mod; import org.jackhuang.hmcl.util.Lang; +import java.io.File; import java.util.List; /** @@ -61,7 +62,7 @@ public interface ModAdviser { "optionsof.txt" /* OptiFine */, "journeymap" /* JourneyMap */, "optionsshaders.txt", - "mods/VoxelMods"); + "mods" + File.separator + "VoxelMods"); static ModAdviser.ModSuggestion suggestMod(String fileName, boolean isDirectory) { if (match(MODPACK_BLACK_LIST, fileName, isDirectory)) @@ -75,7 +76,7 @@ public interface ModAdviser { static boolean match(List l, String fileName, boolean isDirectory) { for (String s : l) if (isDirectory) { - if (fileName.startsWith(s + "/")) + if (fileName.startsWith(s + File.separator)) return true; } else { if (s.startsWith("regex:")) { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/Modpack.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/Modpack.java index 1a3b05fa3..8a61824dd 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/Modpack.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/Modpack.java @@ -119,9 +119,8 @@ public abstract class Modpack { public static boolean acceptFile(String path, List blackList, List whiteList) { if (path.isEmpty()) return true; - for (String s : blackList) - if (path.equals(s)) - return false; + if (ModAdviser.match(blackList, path, false)) + return false; if (whiteList == null || whiteList.isEmpty()) return true; for (String s : whiteList)