From 98fc073f8967d8c5bb54d82fd8d80393d6b87802 Mon Sep 17 00:00:00 2001 From: RipleyTom Date: Fri, 14 Apr 2023 15:40:04 +0200 Subject: [PATCH] Fix tmp path in updater --- rpcs3/rpcs3qt/update_manager.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/rpcs3/rpcs3qt/update_manager.cpp b/rpcs3/rpcs3qt/update_manager.cpp index d2890e509f..15debc6d5b 100644 --- a/rpcs3/rpcs3qt/update_manager.cpp +++ b/rpcs3/rpcs3qt/update_manager.cpp @@ -387,12 +387,10 @@ bool update_manager::handle_rpcs3(const QByteArray& data, bool auto_accept) const std::string orig_path = exe_dir + "rpcs3.exe"; const std::wstring wchar_orig_path = utf8_to_wchar(orig_path); - char temp_path[PATH_MAX]; + wchar_t wide_temp_path[MAX_PATH + 1]{}; + GetTempPathW(sizeof(wide_temp_path), wide_temp_path); - GetTempPathA(sizeof(temp_path) - 1, temp_path); - temp_path[PATH_MAX - 1] = 0; - - std::string tmpfile_path = temp_path; + std::string tmpfile_path = wchar_to_utf8(wide_temp_path); tmpfile_path += "\\rpcs3_update.7z"; fs::file tmpfile(tmpfile_path, fs::read + fs::write + fs::create + fs::trunc);