mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2026-10-29 07:06:49 +08:00
[release/3.16] [Bugfix] 修复无法读取 zip 后缀名的模组的问题 (#6875)
https://github.com/HMCL-dev/HMCL/pull/6712 Co-authored-by: ToobLac <tooblac39@gmail.com>
This commit is contained in:
@@ -172,7 +172,7 @@ public final class ModListPage extends ListPageBase<ModListPageSkin.ModInfoObjec
|
||||
public void add() {
|
||||
FileChooser chooser = new FileChooser();
|
||||
chooser.setTitle(i18n("mods.add.title"));
|
||||
chooser.getExtensionFilters().setAll(new FileChooser.ExtensionFilter(i18n("extension.mod"), "*.jar", "*.litemod"));
|
||||
chooser.getExtensionFilters().setAll(new FileChooser.ExtensionFilter(i18n("extension.mod"), "*.jar", "*.zip", "*.litemod"));
|
||||
List<Path> res = FileUtils.toPaths(chooser.showOpenMultipleDialog(Controllers.getStage()));
|
||||
|
||||
if (res == null) return;
|
||||
|
||||
@@ -38,7 +38,7 @@ import static org.jackhuang.hmcl.util.Pair.pair;
|
||||
import static org.jackhuang.hmcl.util.logging.Logger.LOG;
|
||||
|
||||
public final class ModManager extends LocalAddonManager<LocalModFile> {
|
||||
public static final List<String> MOD_EXTENSIONS = List.of("jar", "litemod");
|
||||
public static final List<String> MOD_EXTENSIONS = List.of("jar", "zip", "litemod");
|
||||
|
||||
@FunctionalInterface
|
||||
private interface ModMetadataReader {
|
||||
@@ -58,6 +58,7 @@ public final class ModManager extends LocalAddonManager<LocalModFile> {
|
||||
);
|
||||
|
||||
map.put("jar", zipReaders);
|
||||
map.put("zip", zipReaders);
|
||||
map.put("litemod", List.of(pair(LiteModMetadata::fromFile, ModLoaderType.LITE_LOADER)));
|
||||
|
||||
READERS = map;
|
||||
|
||||
Reference in New Issue
Block a user