From 204d9ff1b289d87f7153996c89bf8e16ca2f0cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Via=C4=8Das=C5=82a=C5=AD?= Date: Wed, 7 Aug 2024 00:02:36 +0000 Subject: [PATCH] (Win32) Fix path to executable (#16852) --- frontend/drivers/platform_win32.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index 47e7ebd421..26ed25c04f 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -750,24 +750,19 @@ static void frontend_win32_respawn(char *s, size_t len, char *args) { STARTUPINFO si; PROCESS_INFORMATION pi; - char executable_args[PATH_MAX_LENGTH]; char executable_path[PATH_MAX_LENGTH] = {0}; if (win32_fork_mode != FRONTEND_FORK_RESTART) return; - fill_pathname_application_path(executable_path, - sizeof(executable_path)); + GetModuleFileName(NULL, executable_path, PATH_MAX_LENGTH); path_set(RARCH_PATH_CORE, executable_path); - /* Remove executable path from arguments given to CreateProcess */ - strlcpy(executable_args, strstr(args, ".exe") + 4, sizeof(executable_args)); - memset(&si, 0, sizeof(si)); si.cb = sizeof(si); memset(&pi, 0, sizeof(pi)); - if (!CreateProcess(executable_path, executable_args, + if (!CreateProcess(executable_path, GetCommandLine(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) RARCH_ERR("Failed to restart RetroArch\n"); }