@@ -45,7 +45,7 @@ static std::string GetFullHandlePath(const fml::UniqueFD& handle) {
4545 // was cached
4646 if (result && memcmp (found.value ().id .Identifier , info.FileId .Identifier ,
4747 sizeof (FILE_ID_INFO))) {
48- return WideStringToString (found.value ().filename );
48+ return WideStringToUtf8 (found.value ().filename );
4949 } else {
5050 fml::internal::os_win::UniqueFDTraits::RemoveCacheEntry (handle.get ());
5151 }
@@ -59,7 +59,7 @@ static std::string GetFullHandlePath(const fml::UniqueFD& handle) {
5959 if (buffer_size == 0 ) {
6060 return {};
6161 }
62- return WideStringToString ({buffer, buffer_size});
62+ return WideStringToUtf8 ({buffer, buffer_size});
6363#endif
6464}
6565
@@ -106,7 +106,7 @@ static DWORD GetShareFlags(FilePermission permission) {
106106}
107107
108108static DWORD GetFileAttributesForUtf8Path (const char * absolute_path) {
109- return ::GetFileAttributes (StringToWideString (absolute_path).c_str ());
109+ return ::GetFileAttributes (Utf8ToWideString (absolute_path).c_str ());
110110}
111111
112112static DWORD GetFileAttributesForUtf8Path (const fml::UniqueFD& base_directory,
@@ -147,15 +147,15 @@ std::string CreateTemporaryDirectory() {
147147 stream << temp_dir_container << " \\ " << uuid_str;
148148 auto temp_dir = stream.str ();
149149
150- auto dir_fd = OpenDirectory (WideStringToString (temp_dir).c_str (), true ,
150+ auto dir_fd = OpenDirectory (WideStringToUtf8 (temp_dir).c_str (), true ,
151151 FilePermission::kReadWrite );
152152 if (!dir_fd.is_valid ()) {
153153 FML_DLOG (ERROR) << " Could not get temporary directory file descriptor. "
154154 << GetLastErrorMessage ();
155155 return {};
156156 }
157157
158- return WideStringToString (std::move (temp_dir));
158+ return WideStringToUtf8 (std::move (temp_dir));
159159}
160160
161161fml::UniqueFD OpenFile (const fml::UniqueFD& base_directory,
@@ -173,7 +173,7 @@ fml::UniqueFD OpenFile(const char* path,
173173 return {};
174174 }
175175
176- auto file_name = StringToWideString ({path});
176+ auto file_name = Utf8ToWideString ({path});
177177
178178 if (file_name.size () == 0 ) {
179179 return {};
@@ -216,7 +216,7 @@ fml::UniqueFD OpenDirectory(const char* path,
216216 return {};
217217 }
218218
219- auto file_name = StringToWideString ({path});
219+ auto file_name = Utf8ToWideString ({path});
220220
221221 if (file_name.size () == 0 ) {
222222 return {};
@@ -314,7 +314,7 @@ bool IsFile(const std::string& path) {
314314}
315315
316316bool UnlinkDirectory (const char * path) {
317- if (!::RemoveDirectory (StringToWideString (path).c_str ())) {
317+ if (!::RemoveDirectory (Utf8ToWideString (path).c_str ())) {
318318 FML_DLOG (ERROR) << " Could not remove directory: '" << path << " '. "
319319 << GetLastErrorMessage ();
320320 return false ;
@@ -324,7 +324,7 @@ bool UnlinkDirectory(const char* path) {
324324
325325bool UnlinkDirectory (const fml::UniqueFD& base_directory, const char * path) {
326326 if (!::RemoveDirectory (
327- StringToWideString (GetAbsolutePath (base_directory, path)).c_str ())) {
327+ Utf8ToWideString (GetAbsolutePath (base_directory, path)).c_str ())) {
328328 FML_DLOG (ERROR) << " Could not remove directory: '" << path << " '. "
329329 << GetLastErrorMessage ();
330330 return false ;
@@ -333,7 +333,7 @@ bool UnlinkDirectory(const fml::UniqueFD& base_directory, const char* path) {
333333}
334334
335335bool UnlinkFile (const char * path) {
336- if (!::DeleteFile (StringToWideString (path).c_str ())) {
336+ if (!::DeleteFile (Utf8ToWideString (path).c_str ())) {
337337 FML_DLOG (ERROR) << " Could not remove file: '" << path << " '. "
338338 << GetLastErrorMessage ();
339339 return false ;
@@ -343,7 +343,7 @@ bool UnlinkFile(const char* path) {
343343
344344bool UnlinkFile (const fml::UniqueFD& base_directory, const char * path) {
345345 if (!::DeleteFile (
346- StringToWideString (GetAbsolutePath (base_directory, path)).c_str ())) {
346+ Utf8ToWideString (GetAbsolutePath (base_directory, path)).c_str ())) {
347347 FML_DLOG (ERROR) << " Could not remove file: '" << path << " '. "
348348 << GetLastErrorMessage ();
349349 return false ;
@@ -436,8 +436,8 @@ bool WriteAtomically(const fml::UniqueFD& base_directory,
436436
437437 temp_file.reset ();
438438
439- if (!::MoveFile (StringToWideString (temp_file_path).c_str (),
440- StringToWideString (file_path).c_str ())) {
439+ if (!::MoveFile (Utf8ToWideString (temp_file_path).c_str (),
440+ Utf8ToWideString (file_path).c_str ())) {
441441 FML_DLOG (ERROR)
442442 << " Could not replace temp file at correct path. File path: "
443443 << file_path << " . Temp file path: " << temp_file_path << " "
@@ -451,8 +451,8 @@ bool WriteAtomically(const fml::UniqueFD& base_directory,
451451bool VisitFiles (const fml::UniqueFD& directory, const FileVisitor& visitor) {
452452 std::string search_pattern = GetFullHandlePath (directory) + " \\ *" ;
453453 WIN32_FIND_DATA find_file_data;
454- HANDLE find_handle = ::FindFirstFile (
455- StringToWideString (search_pattern). c_str (), &find_file_data);
454+ HANDLE find_handle = ::FindFirstFile (Utf8ToWideString (search_pattern). c_str (),
455+ &find_file_data);
456456
457457 if (find_handle == INVALID_HANDLE_VALUE) {
458458 FML_DLOG (ERROR) << " Can't open the directory. Error: "
@@ -461,7 +461,7 @@ bool VisitFiles(const fml::UniqueFD& directory, const FileVisitor& visitor) {
461461 }
462462
463463 do {
464- std::string filename = WideStringToString (find_file_data.cFileName );
464+ std::string filename = WideStringToUtf8 (find_file_data.cFileName );
465465 if (filename != " ." && filename != " .." ) {
466466 if (!visitor (directory, filename)) {
467467 ::FindClose (find_handle);
0 commit comments