mirror of https://github.com/snes9xgit/snes9x.git
Always interpret strings as utf8 in fscompat
This commit is contained in:
parent
d8eb6c7074
commit
7a268ef91c
22
fscompat.cpp
22
fscompat.cpp
|
@ -58,20 +58,20 @@ namespace fs = std::filesystem;
|
||||||
SplitPath splitpath(string str)
|
SplitPath splitpath(string str)
|
||||||
{
|
{
|
||||||
SplitPath output{};
|
SplitPath output{};
|
||||||
fs::path path(str);
|
fs::path path(fs::u8path(str));
|
||||||
|
|
||||||
if (path.has_root_name())
|
if (path.has_root_name())
|
||||||
output.drive = path.root_name().string();
|
output.drive = path.root_name().u8string();
|
||||||
|
|
||||||
if (path.has_filename())
|
if (path.has_filename())
|
||||||
{
|
{
|
||||||
output.stem = path.stem().string();
|
output.stem = path.stem().u8string();
|
||||||
output.ext = path.extension().string();
|
output.ext = path.extension().u8string();
|
||||||
path.remove_filename();
|
path.remove_filename();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path.empty())
|
if (!path.empty())
|
||||||
output.dir = path.string();
|
output.dir = path.u8string();
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
@ -82,16 +82,16 @@ string makepath(const string &drive, const string &dir, const string &stem, cons
|
||||||
|
|
||||||
if (dot_position == string::npos)
|
if (dot_position == string::npos)
|
||||||
{
|
{
|
||||||
fs::path path(drive);
|
fs::path path(fs::u8path(drive));
|
||||||
path = path / dir / stem;
|
path = path / fs::u8path(dir) / fs::u8path(stem);
|
||||||
path.replace_extension(ext);
|
path.replace_extension(ext);
|
||||||
return path.string();
|
return path.u8string();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto filename = stem + ext;
|
auto filename = stem + ext;
|
||||||
fs::path path(drive);
|
fs::path path(fs::u8path(drive));
|
||||||
path = path / dir / filename;
|
path = path / fs::u8path(dir) / fs::u8path(filename);
|
||||||
return path.string();
|
return path.u8string();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue