QStandardPaths

This commit is contained in:
DanielSvoboda 2024-12-22 17:24:52 -03:00
parent b799f2747a
commit 530267e6d1

View File

@ -15,6 +15,7 @@
#include <QNetworkRequest>
#include <QProcess>
#include <QPushButton>
#include <QStandardPaths>
#include <QString>
#include <QStringList>
#include <QTextEdit>
@ -348,7 +349,9 @@ void CheckUpdate::DownloadUpdate(const QString& url) {
QString userPath;
Common::FS::PathToQString(userPath, Common::FS::GetUserPath(Common::FS::PathType::UserDir));
#ifdef Q_OS_WIN
QString tempDownloadPath = QString(getenv("LOCALAPPDATA")) + "/Temp/temp_download_update";
QString tempDownloadPath =
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) +
"/Temp/temp_download_update";
#else
QString tempDownloadPath = userPath + "/temp_download_update";
#endif
@ -397,10 +400,11 @@ void CheckUpdate::Install() {
QString processCommand;
#ifdef Q_OS_WIN
// On windows, overwrite tempDirPath with AppData/Local/Temp folder
// On windows, overwrite tempDirPath with AppData/Roaming/shadps4/Temp folder
// due to PowerShell Expand-Archive not being able to handle correctly
// paths in square brackets (ie: ./[shadps4])
tempDirPath = QString(getenv("LOCALAPPDATA")) + "/Temp/temp_download_update";
tempDirPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) +
"/Temp/temp_download_update";
// Windows Batch Script
scriptFileName = tempDirPath + "/update.ps1";