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 <flowlnlnln@gmail.com>
This commit is contained in:
flow
2022-06-11 17:19:34 -03:00
parent 9a07ede615
commit 91a5c4bdcb
6 changed files with 57 additions and 12 deletions

View File

@ -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)