fix: remove orphaned metadata to avoid problems with auto-updating insts

Just as my master has taught me. 🔫

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-07-31 21:56:37 -03:00
parent b15544c163
commit 31ba1de53b
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

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(); emit succeeded();
} }