diff --git a/include/ghc/filesystem.hpp b/include/ghc/filesystem.hpp index d63efd1..a5ae8a5 100644 --- a/include/ghc/filesystem.hpp +++ b/include/ghc/filesystem.hpp @@ -1086,7 +1086,7 @@ enum class portable_error { }; GHC_FS_API std::error_code make_error_code(portable_error err); #ifdef GHC_OS_WINDOWS -GHC_FS_API std::error_code make_system_error(DWORD err = 0); +GHC_FS_API std::error_code make_system_error(uint32_t err = 0); #else GHC_FS_API std::error_code make_system_error(int err = 0); #endif @@ -1141,7 +1141,7 @@ GHC_INLINE std::error_code make_error_code(portable_error err) } #ifdef GHC_OS_WINDOWS -GHC_INLINE std::error_code make_system_error(DWORD err) +GHC_INLINE std::error_code make_system_error(uint32_t err) { return std::error_code(err ? static_cast(err) : static_cast(::GetLastError()), std::system_category()); } diff --git a/test/filesystem_test.cpp b/test/filesystem_test.cpp index 4a889c9..9b79584 100644 --- a/test/filesystem_test.cpp +++ b/test/filesystem_test.cpp @@ -37,21 +37,14 @@ #include #include #include -#include #include +#include #include #include -#if defined(WIN32) || defined(_WIN32) -#ifndef __GNUC__ + +#if (defined(WIN32) || defined(_WIN32)) && !defined(__GNUC__) #define NOMINMAX 1 #endif -#include -#else -#include -#include -#include -#include -#endif #ifdef USE_STD_FS #include @@ -84,6 +77,15 @@ using fstream = ghc::filesystem::fstream; } // namespace fs #endif +#if defined(WIN32) || defined(_WIN32) +#include +#else +#include +#include +#include +#include +#endif + #ifndef GHC_FILESYSTEM_FWD_TEST #define CATCH_CONFIG_MAIN #endif