diff --git a/bin/WinLauncher/WinLauncher.exe b/bin/WinLauncher/WinLauncher.exe index e76147274f45..d8cd5bb1930e 100644 Binary files a/bin/WinLauncher/WinLauncher.exe and b/bin/WinLauncher/WinLauncher.exe differ diff --git a/bin/WinLauncher/WinLauncher64.exe b/bin/WinLauncher/WinLauncher64.exe index a95fd33cdd3e..84da839abc03 100644 Binary files a/bin/WinLauncher/WinLauncher64.exe and b/bin/WinLauncher/WinLauncher64.exe differ diff --git a/native/WinLauncher/WinLauncher/WinLauncher.cpp b/native/WinLauncher/WinLauncher/WinLauncher.cpp index 0d4cf2154176..3176ee2131ba 100644 --- a/native/WinLauncher/WinLauncher/WinLauncher.cpp +++ b/native/WinLauncher/WinLauncher/WinLauncher.cpp @@ -104,8 +104,12 @@ bool FindValidJVM(const char* path) std::string GetAdjacentDir(const char* suffix) { char libDir[_MAX_PATH]; - GetCurrentDirectoryA(_MAX_PATH-1, libDir); + GetModuleFileNameA(NULL, libDir, _MAX_PATH-1); char* lastSlash = strrchr(libDir, '\\'); + if (!lastSlash) return ""; + *lastSlash = '\0'; + lastSlash = strrchr(libDir, '\\'); + if (!lastSlash) return ""; strcpy(lastSlash+1, suffix); strcat_s(libDir, "\\"); return std::string(libDir); @@ -261,7 +265,7 @@ std::string FindToolsJar() std::string CollectLibJars(const std::string& jarList) { std::string libDir = GetAdjacentDir("lib"); - if (!FileExists(libDir)) + if (libDir.size() == 0 || !FileExists(libDir)) { return ""; }