From c291946d2a8c3e03940da4070533e124283d303c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 5 Aug 2019 00:44:56 +0200 Subject: NOISSUE do not lose selection on mod enable/disable toggle --- api/logic/minecraft/mod/Mod.cpp | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'api/logic/minecraft/mod/Mod.cpp') 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 +#include 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()); } -- cgit v1.2.3