diff --git a/rpcs3/rpcs3qt/update_manager.cpp b/rpcs3/rpcs3qt/update_manager.cpp index 17b3b9079a..b7300f13fa 100644 --- a/rpcs3/rpcs3qt/update_manager.cpp +++ b/rpcs3/rpcs3qt/update_manager.cpp @@ -305,6 +305,12 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic std::string replace_path; +#ifdef _WIN32 + // Get executable path + wchar_t orig_path[32767]; + GetModuleFileNameW(nullptr, orig_path, sizeof(orig_path) / 2); +#endif + #ifdef __linux__ const char* appimage_path = ::getenv("APPIMAGE"); @@ -558,16 +564,13 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic error_free7z(); if (res) return false; - - replace_path = Emulator::GetEmuDir() + "rpcs3.exe"; - #endif m_progress_dialog->close(); QMessageBox::information(m_parent, tr("Auto-updater"), tr("Update successful!")); #ifdef _WIN32 - int ret = _execl(replace_path.c_str(), replace_path.c_str(), nullptr); + int ret = _wexecl(orig_path, orig_path, nullptr); #else int ret = execl(replace_path.c_str(), replace_path.c_str(), nullptr); #endif