Make SetExecutablePath() on Windows unicode compatible.

This commit is contained in:
Yamagi Burmeister 2018-02-05 10:01:21 +01:00
parent a87e34906c
commit efcaf17f69

View file

@ -57,8 +57,12 @@ static void SetExecutablePath(char* exePath)
// !!! this assumes that exePath can hold PATH_MAX chars !!!
#ifdef _WIN32
WCHAR wexePath[PATH_MAX];
DWORD len;
GetModuleFileNameW(NULL, wexePath, PATH_MAX);
len = WideCharToMultiByte(CP_UTF8, 0, wexePath, -1, exePath, PATH_MAX, NULL, NULL);
DWORD len = GetModuleFileNameA(NULL, exePath, PATH_MAX);
if(len <= 0 || len == PATH_MAX)
{
// an error occured, clear exe path