From 5f947d5ec87fa8b3593b5e8597363d698b11a1cb Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Sun, 3 Dec 2017 01:57:27 +0100 Subject: [PATCH] convenient generic_u8string(path) as workaround Boost not having path.generic_u8string() - a good point for http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0251r0.pdf --- include/nana/filesystem/filesystem_ext.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/nana/filesystem/filesystem_ext.hpp b/include/nana/filesystem/filesystem_ext.hpp index 2c28acad..2ff6bece 100644 --- a/include/nana/filesystem/filesystem_ext.hpp +++ b/include/nana/filesystem/filesystem_ext.hpp @@ -34,6 +34,16 @@ namespace filesystem_ext std::experimental::filesystem::path path_user(); ///< extention ? +/// workaround Boost not having path.generic_u8string() - a good point for http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0251r0.pdf +inline std::string generic_u8string(const std::experimental::filesystem::path& p) +{ + #if NANA_USING_BOOST_FILESYSTEM + return nana::to_utf8(p.generic_wstring()); + #else + return p.generic_u8string(); + #endif +} + inline bool is_directory(const std::experimental::filesystem::directory_entry& dir) noexcept { return is_directory(dir.status());