Skip to content

Commit

Permalink
Merge branch 'shadps4-emu:main' into Full-BB
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolix29 authored Dec 23, 2024
2 parents 3174681 + dfdd819 commit 3f6386b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/qt_gui/check_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <QNetworkRequest>
#include <QProcess>
#include <QPushButton>
#include <QStandardPaths>
#include <QString>
#include <QStringList>
#include <QTextEdit>
Expand Down Expand Up @@ -367,7 +368,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
Expand Down Expand Up @@ -416,10 +419,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";
Expand Down Expand Up @@ -555,6 +559,7 @@ void CheckUpdate::Install() {
QFile scriptFile(scriptFileName);
if (scriptFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream out(&scriptFile);
scriptFile.write("\xEF\xBB\xBF");
#ifdef Q_OS_WIN
out << scriptContent.arg(binaryStartingUpdate).arg(tempDirPath).arg(rootPath);
#endif
Expand Down

0 comments on commit 3f6386b

Please sign in to comment.