From 31ba1de53b2308cdaabda2fa94a7c1a259a8a078 Mon Sep 17 00:00:00 2001 From: flow Date: Sun, 31 Jul 2022 21:56:37 -0300 Subject: [PATCH] fix: remove orphaned metadata to avoid problems with auto-updating insts Just as my master has taught me. :gun: Signed-off-by: flow --- launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp b/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp index a2e055bac..9b70e7a1a 100644 --- a/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp +++ b/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp @@ -83,6 +83,17 @@ void ModFolderLoadTask::run() } } + // Remove orphan metadata to prevent issues + // See https://github.com/PolyMC/PolyMC/issues/996 + QMutableMapIterator 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(); }