diff --git a/components/files/openfile.cpp b/components/files/openfile.cpp index 61a177b038..54b0b28058 100644 --- a/components/files/openfile.cpp +++ b/components/files/openfile.cpp @@ -3,11 +3,20 @@ #include #include +#if defined(_WIN32) || defined(__WINDOWS__) +#include +#endif + namespace Files { std::unique_ptr openBinaryInputFileStream(const std::string& path) { +#if defined(_WIN32) || defined(__WINDOWS__) + std::wstring wpath = boost::locale::conv::utf_to_utf(path); + auto stream = std::make_unique(wpath, std::ios::binary); +#else auto stream = std::make_unique(path, std::ios::binary); +#endif if (!stream->is_open()) throw std::runtime_error("Failed to open '" + path + "' for reading: " + std::strerror(errno)); stream->exceptions(std::ios::badbit); diff --git a/components/vfs/filesystemarchive.cpp b/components/vfs/filesystemarchive.cpp index 206d9aff0c..8b74fb788a 100644 --- a/components/vfs/filesystemarchive.cpp +++ b/components/vfs/filesystemarchive.cpp @@ -29,14 +29,14 @@ namespace VFS if (mPath.size () > 0 && mPath [prefix - 1] != '\\' && mPath [prefix - 1] != '/') ++prefix; - for (directory_iterator i (mPath); i != end; ++i) + for (directory_iterator i (std::filesystem::u8path(mPath)); i != end; ++i) { if(std::filesystem::is_directory (*i)) continue; - std::string proper = i->path ().string (); + auto proper = i->path ().u8string (); - FileSystemArchiveFile file(proper); + FileSystemArchiveFile file(std::string((char*)proper.c_str(), proper.size())); std::string searchable; @@ -44,7 +44,7 @@ namespace VFS const auto inserted = mIndex.insert(std::make_pair(searchable, file)); if (!inserted.second) - Log(Debug::Warning) << "Warning: found duplicate file for '" << proper << "', please check your file system for two files with the same name in different cases."; + Log(Debug::Warning) << "Warning: found duplicate file for '" << std::string((char*)proper.c_str(), proper.size()) << "', please check your file system for two files with the same name in different cases."; else out[inserted.first->first] = &inserted.first->second; }