|
15 | 15 | #include <QNetworkRequest>
|
16 | 16 | #include <QProcess>
|
17 | 17 | #include <QPushButton>
|
| 18 | +#include <QStandardPaths> |
18 | 19 | #include <QString>
|
19 | 20 | #include <QStringList>
|
20 | 21 | #include <QTextEdit>
|
@@ -348,7 +349,9 @@ void CheckUpdate::DownloadUpdate(const QString& url) {
|
348 | 349 | QString userPath;
|
349 | 350 | Common::FS::PathToQString(userPath, Common::FS::GetUserPath(Common::FS::PathType::UserDir));
|
350 | 351 | #ifdef Q_OS_WIN
|
351 |
| - QString tempDownloadPath = QString(getenv("LOCALAPPDATA")) + "/Temp/temp_download_update"; |
| 352 | + QString tempDownloadPath = |
| 353 | + QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + |
| 354 | + "/Temp/temp_download_update"; |
352 | 355 | #else
|
353 | 356 | QString tempDownloadPath = userPath + "/temp_download_update";
|
354 | 357 | #endif
|
@@ -397,10 +400,11 @@ void CheckUpdate::Install() {
|
397 | 400 | QString processCommand;
|
398 | 401 |
|
399 | 402 | #ifdef Q_OS_WIN
|
400 |
| - // On windows, overwrite tempDirPath with AppData/Local/Temp folder |
| 403 | + // On windows, overwrite tempDirPath with AppData/Roaming/shadps4/Temp folder |
401 | 404 | // due to PowerShell Expand-Archive not being able to handle correctly
|
402 | 405 | // paths in square brackets (ie: ./[shadps4])
|
403 |
| - tempDirPath = QString(getenv("LOCALAPPDATA")) + "/Temp/temp_download_update"; |
| 406 | + tempDirPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + |
| 407 | + "/Temp/temp_download_update"; |
404 | 408 |
|
405 | 409 | // Windows Batch Script
|
406 | 410 | scriptFileName = tempDirPath + "/update.ps1";
|
@@ -536,6 +540,7 @@ void CheckUpdate::Install() {
|
536 | 540 | QFile scriptFile(scriptFileName);
|
537 | 541 | if (scriptFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
538 | 542 | QTextStream out(&scriptFile);
|
| 543 | + scriptFile.write("\xEF\xBB\xBF"); |
539 | 544 | #ifdef Q_OS_WIN
|
540 | 545 | out << scriptContent.arg(binaryStartingUpdate).arg(tempDirPath).arg(rootPath);
|
541 | 546 | #endif
|
|
0 commit comments