diff options
author | TheKodeToad <TheKodeToad@proton.me> | 2023-07-11 11:14:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-11 11:14:06 +0100 |
commit | 4c6929038159a29c437b30616daa0b2672531e4d (patch) | |
tree | ba99c0783670059b7818aa14d3720f7798081ed7 /launcher/minecraft/mod/Resource.cpp | |
parent | 64c591b234cec2519d8a04b32d4b6e85dcf204da (diff) | |
parent | 640aaa8c23d714ce17bc8e78754af6219abc6466 (diff) | |
download | PrismLauncher-4c6929038159a29c437b30616daa0b2672531e4d.tar.gz PrismLauncher-4c6929038159a29c437b30616daa0b2672531e4d.tar.bz2 PrismLauncher-4c6929038159a29c437b30616daa0b2672531e4d.zip |
Merge branch 'develop' into better-component-installation
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Diffstat (limited to 'launcher/minecraft/mod/Resource.cpp')
-rw-r--r-- | launcher/minecraft/mod/Resource.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/launcher/minecraft/mod/Resource.cpp b/launcher/minecraft/mod/Resource.cpp index a0b8a4bb..098a617f 100644 --- a/launcher/minecraft/mod/Resource.cpp +++ b/launcher/minecraft/mod/Resource.cpp @@ -71,6 +71,7 @@ std::pair<int, bool> Resource::compare(const Resource& other, SortType type) con return { 1, type == SortType::ENABLED }; if (!enabled() && other.enabled()) return { -1, type == SortType::ENABLED }; + break; case SortType::NAME: { QString this_name{ name() }; QString other_name{ other.name() }; @@ -81,12 +82,14 @@ std::pair<int, bool> Resource::compare(const Resource& other, SortType type) con auto compare_result = QString::compare(this_name, other_name, Qt::CaseInsensitive); if (compare_result != 0) return { compare_result, type == SortType::NAME }; + break; } case SortType::DATE: if (dateTimeChanged() > other.dateTimeChanged()) return { 1, type == SortType::DATE }; if (dateTimeChanged() < other.dateTimeChanged()) return { -1, type == SortType::DATE }; + break; } return { 0, false }; @@ -145,14 +148,10 @@ bool Resource::enable(EnableAction action) return true; } -bool Resource::destroy() +bool Resource::destroy(bool attemptTrash) { m_type = ResourceType::UNKNOWN; - - if (FS::trash(m_file_info.filePath())) - return true; - - return FS::deletePath(m_file_info.filePath()); + return (attemptTrash && FS::trash(m_file_info.filePath())) || FS::deletePath(m_file_info.filePath()); } bool Resource::isSymLinkUnder(const QString& instPath) const |