diff options
| author | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-07-13 20:05:16 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-13 20:05:16 -0700 |
| commit | 520594e5296b09205e55bc018b1f759df5725e96 (patch) | |
| tree | 07e334684062151c5fdf699e805d9326255a3dc3 /launcher/minecraft/mod/Resource.cpp | |
| parent | 8d7dcdfc5b2a231a1304878e25929e6f4ff4e338 (diff) | |
| parent | 94d4d12ee0a12572b2b661003f10cfbdda1b434a (diff) | |
| download | PrismLauncher-520594e5296b09205e55bc018b1f759df5725e96.tar.gz PrismLauncher-520594e5296b09205e55bc018b1f759df5725e96.tar.bz2 PrismLauncher-520594e5296b09205e55bc018b1f759df5725e96.zip | |
Merge branch 'develop' into chore/add-compiler-warnings
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
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 |
