aboutsummaryrefslogtreecommitdiff
path: root/launcher/FileSystem.cpp
diff options
context:
space:
mode:
authorAaron Sonin <10217842+byteduck@users.noreply.github.com>2023-01-12 20:11:46 -0800
committerGitHub <noreply@github.com>2023-01-12 20:11:46 -0800
commitb2f48eaeb8cd6dbdf9b8bbbf1a163339c88173a7 (patch)
tree80773415691e538d437bc03c42f73a8abd01f126 /launcher/FileSystem.cpp
parent160dd09fc2788fea17c8e9e332c2877586640971 (diff)
parent5e89ba70797df863c7eeae9b147080e7dbdf6d3b (diff)
downloadPrismLauncher-b2f48eaeb8cd6dbdf9b8bbbf1a163339c88173a7.tar.gz
PrismLauncher-b2f48eaeb8cd6dbdf9b8bbbf1a163339c88173a7.tar.bz2
PrismLauncher-b2f48eaeb8cd6dbdf9b8bbbf1a163339c88173a7.zip
Merge branch 'PrismLauncher:develop' into instance-accounts
Diffstat (limited to 'launcher/FileSystem.cpp')
-rw-r--r--launcher/FileSystem.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp
index b3af4f4e..aee5245d 100644
--- a/launcher/FileSystem.cpp
+++ b/launcher/FileSystem.cpp
@@ -57,6 +57,7 @@
#include <shlobj.h>
#include <shobjidl.h>
#include <sys/utime.h>
+#include <versionhelpers.h>
#include <windows.h>
#include <winnls.h>
#include <string>
@@ -214,6 +215,22 @@ bool copy::operator()(const QString& offset, bool dryRun)
return err.value() == 0;
}
+bool move(const QString& source, const QString& dest)
+{
+ std::error_code err;
+
+ ensureFilePathExists(dest);
+ fs::rename(StringUtils::toStdString(source), StringUtils::toStdString(dest), err);
+
+ if (err) {
+ qWarning() << "Failed to move file:" << QString::fromStdString(err.message());
+ qDebug() << "Source file:" << source;
+ qDebug() << "Destination file:" << dest;
+ }
+
+ return err.value() == 0;
+}
+
bool deletePath(QString path)
{
std::error_code err;
@@ -235,6 +252,10 @@ bool trash(QString path, QString *pathInTrash)
// FIXME: Figure out trash in Flatpak. Qt seemingly doesn't use the Trash portal
if (DesktopServices::isFlatpak())
return false;
+#if defined Q_OS_WIN32
+ if (IsWindowsServer())
+ return false;
+#endif
return QFile::moveToTrash(path, pathInTrash);
#endif
}