From 7908f6ae768c6034829e2c8d340e67cfb136c427 Mon Sep 17 00:00:00 2001 From: Vladislav Shchapov Date: Tue, 31 May 2022 21:38:24 +0500 Subject: [PATCH] Make std::filesystem::path formatter utf-8 compatible. Signed-off-by: Vladislav Shchapov --- include/fmt/std.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/fmt/std.h b/include/fmt/std.h index 0ba929fac54e..8d93b985161b 100644 --- a/include/fmt/std.h +++ b/include/fmt/std.h @@ -28,6 +28,16 @@ void write_escaped_path(basic_memory_buffer& quoted, const std::filesystem::path& p) { write_escaped_string(std::back_inserter(quoted), p.string()); } +# ifdef _WIN32 +template <> +void write_escaped_path(basic_memory_buffer& quoted, + const std::filesystem::path& p) { + auto s = p.u8string(); + write_escaped_string( + std::back_inserter(quoted), + string_view(reinterpret_cast(s.c_str()), s.size())); +} +# endif template <> void write_escaped_path( basic_memory_buffer& quoted,