change to GetModuleFileNameW instead

This commit is contained in:
DeaTh-G 2025-03-19 12:32:52 +01:00
parent 51a34c98e7
commit bb2947dd29

View file

@ -185,7 +185,10 @@ void SetWorkingDirectoryToExecutable()
std::filesystem::path exePath; std::filesystem::path exePath;
#ifdef _WIN32 #ifdef _WIN32
exePath = std::filesystem::canonical(std::filesystem::path(_pgmptr)); wchar_t path[MAX_PATH];
GetModuleFileNameW(NULL, path, sizeof(path));
exePath = path;
#else #else
exePath = std::filesystem::canonical("/proc/self/exe"); exePath = std::filesystem::canonical("/proc/self/exe");
#endif #endif