diff options
author | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-05-28 11:25:58 -0700 |
---|---|---|
committer | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-07-11 21:42:29 -0700 |
commit | 9957aeb003a28f24a7d3b2bbc46d21c31506615d (patch) | |
tree | 891048851c7819f334abf384a7d99dbeec7bf0ea /launcher/minecraft/mod/Resource.cpp | |
parent | eb079c80605f88cbd0aaff8285dafc459c6f42eb (diff) | |
parent | 640aaa8c23d714ce17bc8e78754af6219abc6466 (diff) | |
download | PrismLauncher-9957aeb003a28f24a7d3b2bbc46d21c31506615d.tar.gz PrismLauncher-9957aeb003a28f24a7d3b2bbc46d21c31506615d.tar.bz2 PrismLauncher-9957aeb003a28f24a7d3b2bbc46d21c31506615d.zip |
Merge branch 'develop' into curseforge-url-handle
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 |