@@ -347,7 +347,11 @@ void CheckUpdate::DownloadUpdate(const QString& url) {
347
347
348
348
QString userPath;
349
349
Common::FS::PathToQString (userPath, Common::FS::GetUserPath (Common::FS::PathType::UserDir));
350
+ #ifdef Q_OS_WIN
351
+ QString tempDownloadPath = QString (getenv (" LOCALAPPDATA" )) + " /Temp/temp_download_update" ;
352
+ #else
350
353
QString tempDownloadPath = userPath + " /temp_download_update" ;
354
+ #endif
351
355
QDir dir (tempDownloadPath);
352
356
if (!dir.exists ()) {
353
357
dir.mkpath (" ." );
@@ -393,6 +397,11 @@ void CheckUpdate::Install() {
393
397
QString processCommand;
394
398
395
399
#ifdef Q_OS_WIN
400
+ // On windows, overwrite tempDirPath with AppData/Local/Temp folder
401
+ // due to PowerShell Expand-Archive not being able to handle correctly
402
+ // paths in square brackets (ie: ./[shadps4])
403
+ tempDirPath = QString (getenv (" LOCALAPPDATA" )) + " /Temp/temp_download_update" ;
404
+
396
405
// Windows Batch Script
397
406
scriptFileName = tempDirPath + " /update.ps1" ;
398
407
scriptContent = QStringLiteral (
@@ -408,10 +417,11 @@ void CheckUpdate::Install() {
408
417
" Start-Sleep -Seconds 3\n "
409
418
" Copy-Item -Recurse -Force '%2\\ *' '%3\\ '\n "
410
419
" Start-Sleep -Seconds 2\n "
411
- " Remove-Item -Force '%3\\ update.ps1'\n "
412
- " Remove-Item -Force '%3\\ temp_download_update.zip'\n "
413
- " Start-Process '%3\\ shadps4.exe'\n "
414
- " Remove-Item -Recurse -Force '%2'\n " );
420
+ " Remove-Item -Force -LiteralPath '%3\\ update.ps1'\n "
421
+ " Remove-Item -Force -LiteralPath '%3\\ temp_download_update.zip'\n "
422
+ " Remove-Item -Recurse -Force '%2'\n "
423
+ " Start-Process -FilePath '%3\\ shadps4.exe' "
424
+ " -WorkingDirectory ([WildcardPattern]::Escape('%3'))\n " );
415
425
arguments << " -ExecutionPolicy"
416
426
<< " Bypass"
417
427
<< " -File" << scriptFileName;
0 commit comments