From f5bfb98aeafdd5e4ebdaa7571e283260be5a9926 Mon Sep 17 00:00:00 2001 From: Steffen Schuemann Date: Sun, 8 Dec 2019 13:49:15 +0100 Subject: [PATCH] minor refactorings and work on ci integration --- cmake/GhcHelper.cmake | 1 + include/ghc/filesystem.hpp | 6 +++--- test/filesystem_test.cpp | 5 +++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/GhcHelper.cmake b/cmake/GhcHelper.cmake index 5443d36..edbbca7 100644 --- a/cmake/GhcHelper.cmake +++ b/cmake/GhcHelper.cmake @@ -16,6 +16,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND (CMAKE_CXX_COMPILER_VERSION endif() else() if(NOT APPLE) + target_compile_options(${targetName} PRIVATE "-stdlib=libc++") target_link_libraries(${targetName} -stdlib=libc++) endif() endif() diff --git a/include/ghc/filesystem.hpp b/include/ghc/filesystem.hpp index ed0b647..2265280 100644 --- a/include/ghc/filesystem.hpp +++ b/include/ghc/filesystem.hpp @@ -177,7 +177,7 @@ //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // ghc::filesystem version in decimal (major * 10000 + minor * 100 + patch) -#define GHC_FILESYSTEM_VERSION 10210L +#define GHC_FILESYSTEM_VERSION 10211L namespace ghc { namespace filesystem { @@ -677,7 +677,7 @@ private: file_status _symlink_status; uintmax_t _file_size = 0; #ifndef GHC_OS_WINDOWS - uintmax_t _hard_link_count; + uintmax_t _hard_link_count = 0; #endif time_t _last_write_time = 0; }; @@ -2551,7 +2551,7 @@ GHC_INLINE path path::stem() const { impl_string_type fn = filename().string(); if (fn != "." && fn != "..") { - impl_string_type::size_type n = fn.rfind("."); + impl_string_type::size_type n = fn.rfind('.'); if (n != impl_string_type::npos && n != 0) { return fn.substr(0, n); } diff --git a/test/filesystem_test.cpp b/test/filesystem_test.cpp index 7369fcd..6681a0a 100644 --- a/test/filesystem_test.cpp +++ b/test/filesystem_test.cpp @@ -1515,6 +1515,11 @@ TEST_CASE("30.10.15.1 absolute", "[filesystem][operations][fs.op.absolute]") TEST_CASE("30.10.15.2 canonical", "[filesystem][operations][fs.op.canonical]") { CHECK_THROWS_AS(fs::canonical(""), fs::filesystem_error); + { + std::error_code ec; + CHECK(fs::canonical("", ec) == ""); + CHECK(ec); + } CHECK(fs::canonical(fs::current_path()) == fs::current_path()); CHECK(fs::canonical(".") == fs::current_path());