From 9730fb0156d12dd2e8c87e9302fa27cf52296b4a Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 17 May 2022 14:23:56 -0700 Subject: [PATCH] Fix path formatter --- include/fmt/std.h | 15 ++++++++------- test/CMakeLists.txt | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/fmt/std.h b/include/fmt/std.h index 53f21e6fc013..5e7d3668e33c 100644 --- a/include/fmt/std.h +++ b/include/fmt/std.h @@ -8,22 +8,23 @@ #ifndef FMT_STD_H_ #define FMT_STD_H_ -#include +#include "format.h" + +#if FMT_HAS_INCLUDE() +# include +#endif #ifdef __cpp_lib_filesystem # include -namespace fmt { - -template <> struct formatter : formatter { +template <> +struct fmt::formatter : formatter { template - auto format(const path& p, FormatContext& ctx) const -> + auto format(const std::filesystem::path& p, FormatContext& ctx) const -> typename FormatContext::iterator { return formatter::format(p.string(), ctx); } }; - -} // namespace fmt #endif #endif // FMT_STD_H_ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1066c5d727a0..6cdb7ac42fa0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -77,6 +77,7 @@ endif() add_fmt_test(printf-test) add_fmt_test(ranges-test ranges-odr-test.cc) add_fmt_test(scan-test) +add_fmt_test(std-test) add_fmt_test(unicode-test HEADER_ONLY) if (MSVC) target_compile_options(unicode-test PRIVATE /utf-8)