fix missing fs.weakly_canonical for c++11/14

This commit is contained in:
Jinhao
2019-04-19 04:38:30 +08:00
parent 9e91bd0160
commit 8b2dc1eddd
2 changed files with 184 additions and 9 deletions

View File

@@ -108,11 +108,16 @@ namespace std {
{
using namespace experimental::filesystem;
}
#ifndef __cpp_lib_experimental_filesystem
# define __cpp_lib_experimental_filesystem 201406
#endif
} // std
#else
# undef NANA_USING_STD_FILESYSTEM
# define NANA_USING_STD_FILESYSTEM 1
//Detects whether the compiler supports std::filesystem under current options
# if ((defined(_MSC_VER) && (_MSC_VER >= 1912) && defined(_MSVC_LANG) && _MSVC_LANG >= 201703)) || \
((__cplusplus >= 201703L) && \
(defined(__clang__) && (__clang_major__ >= 7) || \
@@ -125,14 +130,11 @@ namespace std {
using namespace std::experimental::filesystem;
}
}
# undef NANA_USING_STD_EXPERIMENTAL_FILESYSTEM
# define NANA_USING_STD_EXPERIMENTAL_FILESYSTEM
# endif
#endif
#ifndef __cpp_lib_experimental_filesystem
# define __cpp_lib_experimental_filesystem 201406
#endif
#if NANA_USING_NANA_FILESYSTEM
#include <string>
@@ -558,7 +560,23 @@ namespace std {
#endif
}
} // std
#else
//Implements the missing functions for various version of experimental/filesystem
# if defined(NANA_USING_STD_EXPERIMENTAL_FILESYSTEM)
namespace std
{
namespace filesystem
{
//Visual Studio 2017
#if (defined(_MSC_VER) && (_MSC_VER > 1912)) || \
(!defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 801))
path weakly_canonical(const path& p);
path weakly_canonical(const path& p, std::error_code& err);
#endif
}
}
# endif
#endif //NANA_USING_NANA_FILESYSTEM