diff options
author | Petr Mrázek <peterix@gmail.com> | 2019-08-05 00:44:56 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2019-08-05 00:46:59 +0200 |
commit | c291946d2a8c3e03940da4070533e124283d303c (patch) | |
tree | 23155f22afed3812b187b915d2f28b8dc0c5e0f2 /api/logic/minecraft/mod/Mod.cpp | |
parent | dfb30d91397f6b5ed80d94b7dde4e71346b1be35 (diff) | |
download | MultiMC-0.6.7.tar MultiMC-0.6.7.tar.gz MultiMC-0.6.7.tar.lz MultiMC-0.6.7.tar.xz MultiMC-0.6.7.zip |
NOISSUE do not lose selection on mod enable/disable toggle0.6.7
Diffstat (limited to 'api/logic/minecraft/mod/Mod.cpp')
-rw-r--r-- | api/logic/minecraft/mod/Mod.cpp | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/api/logic/minecraft/mod/Mod.cpp b/api/logic/minecraft/mod/Mod.cpp index aa2496c2..df8b406d 100644 --- a/api/logic/minecraft/mod/Mod.cpp +++ b/api/logic/minecraft/mod/Mod.cpp @@ -18,6 +18,7 @@ #include "Mod.h" #include <QDebug> +#include <FileSystem.h> namespace { @@ -100,34 +101,15 @@ bool Mod::enable(bool value) if (!foo.rename(path)) return false; } - m_file = QFileInfo(path); + repath(QFileInfo(path)); m_enabled = value; return true; } bool Mod::destroy() { - if (m_type == MOD_FOLDER) - { - QDir d(m_file.filePath()); - if (d.removeRecursively()) - { - m_type = MOD_UNKNOWN; - return true; - } - return false; - } - else if (m_type == MOD_SINGLEFILE || m_type == MOD_ZIPFILE || m_type == MOD_LITEMOD) - { - QFile f(m_file.filePath()); - if (f.remove()) - { - m_type = MOD_UNKNOWN; - return true; - } - return false; - } - return true; + m_type = MOD_UNKNOWN; + return FS::deletePath(m_file.filePath()); } |