Use wide strings in util::executable_path()

This commit is contained in:
Nikita Lisitsa 2025-03-04 19:59:04 +03:00
parent ef85eec178
commit d41c53193d

View file

@ -14,10 +14,10 @@ namespace psemek::util
std::filesystem::path executable_path() std::filesystem::path executable_path()
{ {
#if defined WIN32 #if defined WIN32
std::string result(256, '\0'); std::wstring result(256, '\0');
while (true) while (true)
{ {
GetModuleFileNameA(NULL, result.data(), result.size()); GetModuleFileNameW(NULL, result.data(), result.size());
auto error = GetLastError(); auto error = GetLastError();
if (error == ERROR_SUCCESS) if (error == ERROR_SUCCESS)
break; break;