| 1 | #ifndef CPR_FILESYSTEM_H |
| 2 | #define CPR_FILESYSTEM_H |
| 3 | |
| 4 | // Include filesystem into the namespace "fs" from either "filesystem" or "experimental/filesystem" or "boost/filesystem" |
| 5 | #ifdef CPR_USE_BOOST_FILESYSTEM |
| 6 | #define BOOST_FILESYSTEM_VERSION 4 // Use the latest, with the closest behavior to std::filesystem. |
| 7 | #include <boost/filesystem.hpp> |
| 8 | namespace cpr { |
| 9 | namespace fs = boost::filesystem; |
| 10 | } |
| 11 | // cppcheck-suppress preprocessorErrorDirective |
| 12 | #elif __has_include(<filesystem>) |
| 13 | #include <filesystem> |
| 14 | namespace cpr { |
| 15 | namespace fs = std::filesystem; |
| 16 | } |
| 17 | #elif __has_include("experimental/filesystem") |
| 18 | #include <experimental/filesystem> |
| 19 | namespace cpr { |
| 20 | namespace fs = std::experimental::filesystem; |
| 21 | } |
| 22 | #else |
| 23 | #error "Failed to include <filesystem> header!" |
| 24 | #endif |
| 25 | |
| 26 | #endif |
| 27 | |