mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-16 15:26:27 -04:00
Fix installing MultiMC modpack
This commit is contained in:
parent
43d8d96608
commit
4c59ed3ccf
@ -19,6 +19,7 @@ package org.jackhuang.hmcl.mod;
|
|||||||
|
|
||||||
import org.jackhuang.hmcl.util.CompressingUtils;
|
import org.jackhuang.hmcl.util.CompressingUtils;
|
||||||
import org.jackhuang.hmcl.util.Lang;
|
import org.jackhuang.hmcl.util.Lang;
|
||||||
|
import org.jackhuang.hmcl.util.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -268,7 +269,7 @@ public final class MultiMCInstanceConfiguration {
|
|||||||
try (FileSystem fs = CompressingUtils.createReadOnlyZipFileSystem(modpackFile.toPath())) {
|
try (FileSystem fs = CompressingUtils.createReadOnlyZipFileSystem(modpackFile.toPath())) {
|
||||||
Path root = Files.list(fs.getPath("/")).filter(Files::isDirectory).findAny()
|
Path root = Files.list(fs.getPath("/")).filter(Files::isDirectory).findAny()
|
||||||
.orElseThrow(() -> new IOException("Not a valid MultiMC modpack"));
|
.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");
|
Path instancePath = root.resolve("instance.cfg");
|
||||||
if (Files.notExists(instancePath))
|
if (Files.notExists(instancePath))
|
||||||
|
@ -120,7 +120,7 @@ public final class MultiMCModpackInstallTask extends Task {
|
|||||||
|
|
||||||
if (Files.exists(patches))
|
if (Files.exists(patches))
|
||||||
for (Path patchJson : Files.newDirectoryStream(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);
|
MultiMCInstancePatch patch = Constants.GSON.fromJson(IOUtils.readFullyAsString(Files.newInputStream(patchJson)), MultiMCInstancePatch.class);
|
||||||
List<String> newArguments = new LinkedList<>();
|
List<String> newArguments = new LinkedList<>();
|
||||||
for (String arg : patch.getTweakers()) {
|
for (String arg : patch.getTweakers()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user