Merge pull request #1017 from flowln/kill_orphan_metadata

Remove orphaned metadata to avoid problems with auto-updating instances
This commit is contained in:
flow 2022-08-04 12:57:20 -07:00 committed by GitHub
commit 75f92de8f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,6 +83,17 @@ void ModFolderLoadTask::run()
}
}
// Remove orphan metadata to prevent issues
// See https://github.com/PolyMC/PolyMC/issues/996
QMutableMapIterator<QString, Mod::Ptr> iter(m_result->mods);
while (iter.hasNext()) {
auto mod = iter.next().value();
if (mod->status() == ModStatus::NotInstalled) {
mod->destroy(m_index_dir, false);
iter.remove();
}
}
emit succeeded();
}