Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,20 @@ public Collection<Task<?>> getDependencies() {
@Override
public void execute() throws Exception {
if (config != null) {
// For update, remove mods not listed in new manifest
for (CurseManifestFile oldCurseManifestFile : config.getManifest().files()) {
// For update, remove mods not listed in new manifest.
// ModpackConfiguration stored in modpack.json preserves the raw
// CurseForge manifest where fileName is missing. CurseCompletionTask
// resolves those file names and writes the enriched manifest to
// manifest.json, so read from there when available.
Path oldManifestFile = repository.getVersionRoot(name).resolve("manifest.json");
List<CurseManifestFile> oldFiles = config.getManifest().files();
if (Files.exists(oldManifestFile)) {
try {
oldFiles = JsonUtils.fromJsonFile(oldManifestFile, CurseManifest.class).files();
} catch (IOException | JsonParseException ignored) {
}
}
for (CurseManifestFile oldCurseManifestFile : oldFiles) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本审查建议由 GPT-5 生成


[P2] 这段删除逻辑会在 ModpackInstallTask 已经解包当前整合包 overrides 之后执行。如果新版整合包把某个旧 Curse manifest mod 改为放在 overrides/mods/<same fileName> 中,ModpackInstallTask 会先写入这个新版 override 文件,随后这里因为该旧 projectID/fileID 不在新版 manifest.files() 中而把同一路径删掉。结果是新版整合包明确包含的 override mod 在更新后丢失,仍可能导致缺 mod 或启动失败。修复时需要避免删除当前包 overrides 中已经提供的 mods/... 路径,或调整删除与解包顺序。

if (StringUtils.isBlank(oldCurseManifestFile.fileName())) continue;
Path oldFile = run.resolve("mods/" + oldCurseManifestFile.fileName());
if (Files.notExists(oldFile)) continue;
Expand Down