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/minecraft/mod/Mod.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'launcher/minecraft/mod/Mod.cpp') diff --git a/launcher/minecraft/mod/Mod.cpp b/launcher/minecraft/mod/Mod.cpp index 81bb902f..bba7b342 100644 --- a/launcher/minecraft/mod/Mod.cpp +++ b/launcher/minecraft/mod/Mod.cpp @@ -164,12 +164,8 @@ void Mod::setMetadata(Metadata::ModStruct* metadata) auto Mod::destroy(QDir& index_dir, bool preserve_metadata) -> bool { - auto n = name(); - // FIXME: This can fail to remove the metadata if the - // "ModMetadataDisabled" setting is on, since there could - // be a name mismatch! - if(!preserve_metadata) - Metadata::remove(index_dir, n); + if (!preserve_metadata && status() != ModStatus::NoMetadata) + Metadata::remove(index_dir, metadata()->mod_id()); m_type = MOD_UNKNOWN; return FS::deletePath(m_file.filePath()); -- cgit