This commit is contained in:
Glavo 2025-07-31 20:05:29 +08:00
parent 6e898149ab
commit df64bb0efa
4 changed files with 7 additions and 1 deletions

View File

@ -75,7 +75,9 @@ public final class MinecraftInstanceTask<T> extends Task<ModpackConfiguration<T>
}
ModpackConfiguration<T> configuration = new ModpackConfiguration<>(manifest, type, name, version, overrides);
JsonUtils.writeToJsonFile(jsonFile.toPath(), configuration);
Path jsonPath = jsonFile.toPath();
Files.createDirectories(jsonPath.getParent());
JsonUtils.writeToJsonFile(jsonPath, configuration);
setResult(configuration);
}
}

View File

@ -28,6 +28,7 @@ import org.jackhuang.hmcl.util.gson.JsonUtils;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
@ -136,6 +137,7 @@ public final class CurseInstallTask extends Task<Void> {
}
Path root = repository.getVersionRoot(name).toPath();
Files.createDirectories(root);
JsonUtils.writeToJsonFile(root.resolve("manifest.json"), JsonUtils.GSON.toJson(manifest));
}
}

View File

@ -173,6 +173,7 @@ public class McbbsModpackCompletionTask extends CompletableFutureTask<Void> {
return executor.all(tasks.stream().filter(Objects::nonNull).collect(Collectors.toList()));
})).thenAcceptAsync(wrapConsumer(unused1 -> {
Path manifestFile = repository.getModpackConfiguration(version).toPath();
Files.createDirectories(manifestFile.getParent());
JsonUtils.writeToJsonFile(manifestFile,
new ModpackConfiguration<>(manifest, this.configuration.getType(), this.manifest.getName(), this.manifest.getVersion(),
this.manifest.getFiles().stream()

View File

@ -179,6 +179,7 @@ public class ServerModpackCompletionTask extends Task<Void> {
public void postExecute() throws Exception {
if (manifest == null || StringUtils.isBlank(manifest.getManifest().getFileApi())) return;
Path manifestFile = repository.getModpackConfiguration(version).toPath();
Files.createDirectories(manifestFile.getParent());
JsonUtils.writeToJsonFile(manifestFile, new ModpackConfiguration<>(remoteManifest, this.manifest.getType(), this.manifest.getName(), this.manifest.getVersion(), remoteManifest.getFiles()));
}
}