diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCInstanceConfiguration.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCInstanceConfiguration.java index c93617b67..1cc52adf8 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCInstanceConfiguration.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCInstanceConfiguration.java @@ -19,6 +19,7 @@ package org.jackhuang.hmcl.mod; import org.jackhuang.hmcl.util.CompressingUtils; import org.jackhuang.hmcl.util.Lang; +import org.jackhuang.hmcl.util.StringUtils; import java.io.File; import java.io.IOException; @@ -268,7 +269,7 @@ public final class MultiMCInstanceConfiguration { try (FileSystem fs = CompressingUtils.createReadOnlyZipFileSystem(modpackFile.toPath())) { Path root = Files.list(fs.getPath("/")).filter(Files::isDirectory).findAny() .orElseThrow(() -> new IOException("Not a valid MultiMC modpack")); - String name = root.normalize().getFileName().toString(); + String name = StringUtils.removeSuffix(root.normalize().getFileName().toString(), "/"); Path instancePath = root.resolve("instance.cfg"); if (Files.notExists(instancePath)) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCModpackInstallTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCModpackInstallTask.java index ba0c91082..d53a18a09 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCModpackInstallTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCModpackInstallTask.java @@ -120,7 +120,7 @@ public final class MultiMCModpackInstallTask extends Task { if (Files.exists(patches)) for (Path patchJson : Files.newDirectoryStream(patches)) { - if (patchJson.endsWith(".json")) { + if (patchJson.toString().endsWith(".json")) { MultiMCInstancePatch patch = Constants.GSON.fromJson(IOUtils.readFullyAsString(Files.newInputStream(patchJson)), MultiMCInstancePatch.class); List newArguments = new LinkedList<>(); for (String arg : patch.getTweakers()) {