Exclude logs and CustomSkinLoader cache

This commit is contained in:
huanghongxun
2019-12-14 12:51:16 +08:00
parent 71131dadb7
commit 829d92c8bb

View File

@@ -20,11 +20,19 @@ package org.jackhuang.hmcl.mod;
import org.jackhuang.hmcl.util.Lang; import org.jackhuang.hmcl.util.Lang;
import java.util.List; import java.util.List;
import java.util.regex.Pattern;
/** /**
* @author huangyuhui * @author huangyuhui
*/ */
public interface ModAdviser { public interface ModAdviser {
/**
* Suggests the file should be displayed, hidden, or included by default.
* @param fileName full path of fileName
* @param isDirectory whether the path is directory
* @return the suggestion to the file
*/
ModSuggestion advise(String fileName, boolean isDirectory); ModSuggestion advise(String fileName, boolean isDirectory);
enum ModSuggestion { enum ModSuggestion {
@@ -34,15 +42,15 @@ public interface ModAdviser {
} }
List<String> MODPACK_BLACK_LIST = Lang.immutableListOf( List<String> MODPACK_BLACK_LIST = Lang.immutableListOf(
"regex:(.*?)\\.log",
"usernamecache.json", "usercache.json", // Minecraft "usernamecache.json", "usercache.json", // Minecraft
"launcher_profiles.json", "launcher.pack.lzma", // Minecraft Launcher "launcher_profiles.json", "launcher.pack.lzma", // Minecraft Launcher
"pack.json", "launcher.jar", "hmclmc.log", "cache", "modpack.cfg", // HMCL "pack.json", "launcher.jar", "cache", "modpack.cfg", // HMCL
"manifest.json", "minecraftinstance.json", ".curseclient", // Curse "manifest.json", "minecraftinstance.json", ".curseclient", // Curse
"minetweaker.log", // Mods
".fabric", ".mixin.out", // Fabric ".fabric", ".mixin.out", // Fabric
"jars", "logs", "versions", "assets", "libraries", "crash-reports", "NVIDIA", "AMD", "screenshots", "natives", "native", "$native", "server-resource-packs", // Minecraft "jars", "logs", "versions", "assets", "libraries", "crash-reports", "NVIDIA", "AMD", "screenshots", "natives", "native", "$native", "server-resource-packs", // Minecraft
"downloads", // Curse "downloads", // Curse
"asm", "backups", "TCNodeTracker", "CustomDISkins", "data" // Mods "asm", "backups", "TCNodeTracker", "CustomDISkins", "data", "CustomSkinLoader/caches" // Mods
); );
List<String> MODPACK_SUGGESTED_BLACK_LIST = Lang.immutableListOf( List<String> MODPACK_SUGGESTED_BLACK_LIST = Lang.immutableListOf(
@@ -68,8 +76,15 @@ public interface ModAdviser {
if (isDirectory) { if (isDirectory) {
if (fileName.startsWith(s + "/")) if (fileName.startsWith(s + "/"))
return true; return true;
} else if (fileName.equals(s)) } else {
return true; if (s.startsWith("regex:")) {
if (fileName.matches(s.substring("regex:".length())))
return true;
} else {
if (fileName.equals(s))
return true;
}
}
return false; return false;
} }
} }