Fix installing MultiMC modpack

This commit is contained in:
huangyuhui 2018-08-18 01:12:22 +08:00
parent 43d8d96608
commit 4c59ed3ccf
2 changed files with 3 additions and 2 deletions

View File

@ -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))

View File

@ -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<String> newArguments = new LinkedList<>();
for (String arg : patch.getTweakers()) {