Use _wexecl on Windows

Allows original path to contain any Unicode character.
This commit is contained in:
Nekotekina 2020-03-08 20:40:23 +03:00
parent 1bbe2e9b15
commit c87beaa694

View File

@ -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