Skip to content

Commit

Permalink
refs #39, remove DWORD dependency in forwarding mode and change test …
Browse files Browse the repository at this point in the history
…to trigger an error if there is a dependency to windows.h
  • Loading branch information
gulrak committed Nov 22, 2019
1 parent c97ac97 commit 5a933d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions include/ghc/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<int>(err) : static_cast<int>(::GetLastError()), std::system_category());
}
Expand Down
22 changes: 12 additions & 10 deletions test/filesystem_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,14 @@
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <random>
#include <set>
#include <sstream>
#include <thread>
#if defined(WIN32) || defined(_WIN32)
#ifndef __GNUC__

#if (defined(WIN32) || defined(_WIN32)) && !defined(__GNUC__)
#define NOMINMAX 1
#endif
#include <windows.h>
#else
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#endif

#ifdef USE_STD_FS
#include <filesystem>
Expand Down Expand Up @@ -84,6 +77,15 @@ using fstream = ghc::filesystem::fstream;
} // namespace fs
#endif

#if defined(WIN32) || defined(_WIN32)
#include <windows.h>
#else
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#endif

#ifndef GHC_FILESYSTEM_FWD_TEST
#define CATCH_CONFIG_MAIN
#endif
Expand Down

0 comments on commit 5a933d5

Please sign in to comment.