Make std::filesystem::path formatter utf-8 compatible.

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
This commit is contained in:
Vladislav Shchapov 2022-05-31 21:38:24 +05:00 committed by Victor Zverovich
parent 232e21d51f
commit b59d8c3a23

View File

@ -28,6 +28,16 @@ void write_escaped_path(basic_memory_buffer<Char>& quoted,
const std::filesystem::path& p) { const std::filesystem::path& p) {
write_escaped_string<Char>(std::back_inserter(quoted), p.string<Char>()); write_escaped_string<Char>(std::back_inserter(quoted), p.string<Char>());
} }
# ifdef _WIN32
template <>
void write_escaped_path<char>(basic_memory_buffer<char>& quoted,
const std::filesystem::path& p) {
auto s = p.u8string();
write_escaped_string<char>(
std::back_inserter(quoted),
string_view(reinterpret_cast<const char*>(s.c_str()), s.size()));
}
# endif
template <> template <>
void write_escaped_path<std::filesystem::path::value_type>( void write_escaped_path<std::filesystem::path::value_type>(
basic_memory_buffer<std::filesystem::path::value_type>& quoted, basic_memory_buffer<std::filesystem::path::value_type>& quoted,