From 91a5c4bdcbd3ae18139b85899f051fb3d9cbd1fc Mon Sep 17 00:00:00 2001 From: flow Date: Sat, 11 Jun 2022 17:19:34 -0300 Subject: feat: add metadata get/delete via mod id This is, in many cases, more reliable than name comparisons, so it's useful specially in cases where a mod changes name between versions Signed-off-by: flow --- launcher/ModDownloadTask.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'launcher/ModDownloadTask.cpp') diff --git a/launcher/ModDownloadTask.cpp b/launcher/ModDownloadTask.cpp index b1dd88d3..7d35ff69 100644 --- a/launcher/ModDownloadTask.cpp +++ b/launcher/ModDownloadTask.cpp @@ -46,8 +46,12 @@ ModDownloadTask::ModDownloadTask(ModPlatform::IndexedPack mod, ModPlatform::Inde void ModDownloadTask::downloadSucceeded() { m_filesNetJob.reset(); - if (!std::get<0>(to_delete).isEmpty()) - mods->uninstallMod(std::get<1>(to_delete), true); + auto name = std::get<0>(to_delete); + if (!name.isEmpty()) { + // If they have the same name, we keep the metadata. + // This is a workaround for mods that change names between versions ;c + mods->uninstallMod(std::get<1>(to_delete), name == m_mod.name); + } } void ModDownloadTask::downloadFailed(QString reason) -- cgit