Skip to content

Commit

Permalink
Fix GetDirectory UTF16 encoding issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcashman committed Feb 14, 2025
1 parent 99ca58d commit 8f9e0c2
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions project/src/backend/sdl/SDLSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,9 @@ namespace lime {

#elif defined (HX_WINDOWS)

char folderPath[MAX_PATH] = "";
SHGetFolderPath (NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, folderPath);
//WIN_StringToUTF8 (folderPath);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
result = new std::wstring (converter.from_bytes (folderPath));
WCHAR folderPath[MAX_PATH] = L"";
SHGetFolderPathW (NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, folderPath);
result = new std::wstring (folderPath);

#elif defined (IPHONE)

Expand Down Expand Up @@ -179,11 +177,9 @@ namespace lime {

#elif defined (HX_WINDOWS)

char folderPath[MAX_PATH] = "";
SHGetFolderPath (NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, folderPath);
//WIN_StringToUTF8 (folderPath);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
result = new std::wstring (converter.from_bytes (folderPath));
WCHAR folderPath[MAX_PATH] = L"";
SHGetFolderPathW (NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, folderPath);
result = new std::wstring (folderPath);

#elif defined (IPHONE)

Expand Down Expand Up @@ -217,11 +213,9 @@ namespace lime {

#elif defined (HX_WINDOWS)

char folderPath[MAX_PATH] = "";
SHGetFolderPath (NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, folderPath);
//WIN_StringToUTF8 (folderPath);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
result = new std::wstring (converter.from_bytes (folderPath));
WCHAR folderPath[MAX_PATH] = L"";
SHGetFolderPathW (NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, folderPath);
result = new std::wstring (folderPath);

#elif defined (HX_MACOS)

Expand Down Expand Up @@ -257,11 +251,9 @@ namespace lime {

#elif defined (HX_WINDOWS)

char folderPath[MAX_PATH] = "";
SHGetFolderPath (NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, folderPath);
//WIN_StringToUTF8 (folderPath);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
result = new std::wstring (converter.from_bytes (folderPath));
WCHAR folderPath[MAX_PATH] = L"";
SHGetFolderPathW (NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, folderPath);
result = new std::wstring (folderPath);

#elif defined (IPHONE)

Expand Down

0 comments on commit 8f9e0c2

Please sign in to comment.