diff options
| author | JosJuice <josjuice@gmail.com> | 2023-08-16 09:54:24 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2023-08-16 09:56:56 +0200 |
| commit | 86910f406e3680c4cb01f37e5f29f894a25342cb (patch) | |
| tree | 165320d74c4d25ffda65b4ea5a57db7666ad5dc1 /Source/Core/VideoCommon/HiresTextures.cpp | |
| parent | a44606692a6be8ba071acb2a4e1e88f4805f4c03 (diff) | |
VideoCommon: Fix std::filesystem::path encoding conversion
In std::string, you can store strings using any encoding, but in Dolphin
we have decided to use UTF-8. The problem is that if you convert between
std::string and std::filesystem::path using the built-in methods, the
standard library will make up its own assumption of what encoding you're
using in the std::string. On most OSes this is UTF-8, but on Windows
it's whatever the user's code page is.
What I believe is the C++ standard authors' intended solution to this is
to use std::u8string instead of std::string, but that's a big hassle to
move over to, because there's no convenient way to convert between
std::string and std::u8string. Instead, in Dolphin, we have added helper
functions that convert between std::string and std::filesystem::path in
the manner we want. You *always* have to use these when converting
between std::string and std::filesystem::path, otherwise we get these
kinds of encoding problems that we've been having with custom textures.
Fixes https://bugs.dolphin-emu.org/issues/13328.
Diffstat (limited to 'Source/Core/VideoCommon/HiresTextures.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/HiresTextures.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp index f9f3134e35..6a489973a5 100644 --- a/Source/Core/VideoCommon/HiresTextures.cpp +++ b/Source/Core/VideoCommon/HiresTextures.cpp @@ -131,7 +131,7 @@ void HiresTexture::Update() // Since this is just a texture (single file) the mapper doesn't really matter // just provide a string s_file_library->SetAssetIDMapData( - filename, std::map<std::string, std::filesystem::path>{{"", path}}); + filename, std::map<std::string, std::filesystem::path>{{"", StringToPath(path)}}); if (g_ActiveConfig.bCacheHiresTextures) { |
