Fix GetDirectory UTF16 encoding issue

This commit is contained in:
Thomas Cashman
2025-02-14 17:34:40 +00:00
committed by Josh Tynjala
parent a999a7b219
commit 52ad5b1b24

View File

@@ -142,11 +142,9 @@ namespace lime {
#elif defined (HX_WINDOWS) #elif defined (HX_WINDOWS)
char folderPath[MAX_PATH] = ""; WCHAR folderPath[MAX_PATH] = L"";
SHGetFolderPath (NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, folderPath); SHGetFolderPathW (NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, folderPath);
//WIN_StringToUTF8 (folderPath); result = new std::wstring (folderPath);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
result = new std::wstring (converter.from_bytes (folderPath));
#elif defined (IPHONE) #elif defined (IPHONE)
@@ -179,11 +177,9 @@ namespace lime {
#elif defined (HX_WINDOWS) #elif defined (HX_WINDOWS)
char folderPath[MAX_PATH] = ""; WCHAR folderPath[MAX_PATH] = L"";
SHGetFolderPath (NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, folderPath); SHGetFolderPathW (NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, folderPath);
//WIN_StringToUTF8 (folderPath); result = new std::wstring (folderPath);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
result = new std::wstring (converter.from_bytes (folderPath));
#elif defined (IPHONE) #elif defined (IPHONE)
@@ -217,11 +213,9 @@ namespace lime {
#elif defined (HX_WINDOWS) #elif defined (HX_WINDOWS)
char folderPath[MAX_PATH] = ""; WCHAR folderPath[MAX_PATH] = L"";
SHGetFolderPath (NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, folderPath); SHGetFolderPathW (NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, folderPath);
//WIN_StringToUTF8 (folderPath); result = new std::wstring (folderPath);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
result = new std::wstring (converter.from_bytes (folderPath));
#elif defined (HX_MACOS) #elif defined (HX_MACOS)
@@ -257,11 +251,9 @@ namespace lime {
#elif defined (HX_WINDOWS) #elif defined (HX_WINDOWS)
char folderPath[MAX_PATH] = ""; WCHAR folderPath[MAX_PATH] = L"";
SHGetFolderPath (NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, folderPath); SHGetFolderPathW (NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, folderPath);
//WIN_StringToUTF8 (folderPath); result = new std::wstring (folderPath);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
result = new std::wstring (converter.from_bytes (folderPath));
#elif defined (IPHONE) #elif defined (IPHONE)