diff options
author | flow <flowlnlnln@gmail.com> | 2022-06-10 19:27:25 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-07-17 11:33:41 -0300 |
commit | 43b9db6e45a2ea74384f7851722952b9a1547213 (patch) | |
tree | 6dce37c971038de6a5ccd28992b44fee86da020d /launcher/minecraft/mod | |
parent | 032ceefa1d4c147477fd432cea64f6cab88b8699 (diff) | |
download | PrismLauncher-43b9db6e45a2ea74384f7851722952b9a1547213.tar.gz PrismLauncher-43b9db6e45a2ea74384f7851722952b9a1547213.tar.bz2 PrismLauncher-43b9db6e45a2ea74384f7851722952b9a1547213.zip |
change: allow deleting mods while preserving their metadata
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/minecraft/mod')
-rw-r--r-- | launcher/minecraft/mod/Mod.cpp | 5 | ||||
-rw-r--r-- | launcher/minecraft/mod/Mod.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/launcher/minecraft/mod/Mod.cpp b/launcher/minecraft/mod/Mod.cpp index 742709e3..37ec8eca 100644 --- a/launcher/minecraft/mod/Mod.cpp +++ b/launcher/minecraft/mod/Mod.cpp @@ -162,13 +162,14 @@ void Mod::setMetadata(Metadata::ModStruct* metadata) } } -auto Mod::destroy(QDir& index_dir) -> bool +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! - Metadata::remove(index_dir, n); + if(!preserve_metadata) + Metadata::remove(index_dir, n); m_type = MOD_UNKNOWN; return FS::deletePath(m_file.filePath()); diff --git a/launcher/minecraft/mod/Mod.h b/launcher/minecraft/mod/Mod.h index 5f9c4684..abb8a52d 100644 --- a/launcher/minecraft/mod/Mod.h +++ b/launcher/minecraft/mod/Mod.h @@ -82,7 +82,7 @@ public: auto enable(bool value) -> bool; // delete all the files of this mod - auto destroy(QDir& index_dir) -> bool; + auto destroy(QDir& index_dir, bool preserve_metadata = false) -> bool; // change the mod's filesystem path (used by mod lists for *MAGIC* purposes) void repath(const QFileInfo &file); |