Просмотр исходного кода

common/file_util: Let std::filesystem cast from UTF16 to std::string

Fix invalid encoding paths when iterating over a directory on Windows.
ReinUsesLisp 5 лет назад
Родитель
Сommit
bab9cae71f
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      src/common/file_util.cpp

+ 1 - 1
src/common/file_util.cpp

@@ -239,7 +239,7 @@ bool ForeachDirectoryEntry(u64* num_entries_out, const std::string& directory,
     }
     // windows loop
     do {
-        const std::string virtual_name(Common::UTF16ToUTF8(ffd.cFileName));
+        const std::string virtual_name = std::filesystem::path(ffd.cFileName).string();
 #else
     DIR* dirp = opendir(directory.c_str());
     if (!dirp)