From 2b898981cb2cf6b1c4b6f73fce4894adacd9140c Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 27 Jul 2020 13:17:36 +0200 Subject: [PATCH] (Windows) Updated some filesystem functions to support wide character filenames. --- es-core/src/utils/FileSystemUtil.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/es-core/src/utils/FileSystemUtil.cpp b/es-core/src/utils/FileSystemUtil.cpp index 1736b2249..a8e331012 100644 --- a/es-core/src/utils/FileSystemUtil.cpp +++ b/es-core/src/utils/FileSystemUtil.cpp @@ -512,7 +512,8 @@ namespace Utils std::string resolved; #if defined(_WIN64) - HANDLE hFile = CreateFile(path.c_str(), FILE_READ_ATTRIBUTES, FILE_SHARE_READ, + HANDLE hFile = CreateFileW(Utils::String::stringToWideString(path).c_str(), + FILE_READ_ATTRIBUTES, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); // TEMPORARY, will need to fix this later. // if (hFile != INVALID_HANDLE_VALUE) { @@ -756,7 +757,8 @@ namespace Utils #if defined(_WIN64) // Check for symlink attribute. - const DWORD Attributes = GetFileAttributes(path.c_str()); + const DWORD Attributes = + GetFileAttributesW(Utils::String::stringToWideString(path).c_str()); if ((Attributes != INVALID_FILE_ATTRIBUTES) && (Attributes & FILE_ATTRIBUTE_REPARSE_POINT)) return true; @@ -780,7 +782,8 @@ namespace Utils #if defined(_WIN64) // Check for hidden attribute. - const DWORD Attributes = GetFileAttributes(path.c_str()); + const DWORD Attributes = + GetFileAttributesW(Utils::String::stringToWideString(path).c_str()); if ((Attributes != INVALID_FILE_ATTRIBUTES) && (Attributes & FILE_ATTRIBUTE_HIDDEN)) return true; #endif // _WIN64