Skip to content

Commit 9600fee

Browse files
authored
Include <filesystem> only if FMT_CPP_LIB_FILESYSTEM is set (#4258)
This change results out of necessity since the Nintendo Switch console SDK does not support `std::filesystem`. The SDK still provides the `<filesystem>` header, but with an `#error` directive, effectively breaking any build that includes `<filesystem>` Because `<filesystem>` is present, `FMT_HAS_INCLUDE` is insufficient here. With this change and `FMT_CPP_LIB_FILESYSTEM` in place, one can define `FMT_CPP_LIB_FILESYSTEM=0` to work around this issue. This assumes that `<filesystem>` can be included (without warnings) if `FMT_CPP_LIB_FILESYSTEM` is set. If this is not the case, fmt would be broken even before this change as `std::filesystem::path` is used without the accompanying header.
1 parent 47a66c5 commit 9600fee

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

include/fmt/std.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727

2828
// Check FMT_CPLUSPLUS to suppress a bogus warning in MSVC.
2929
# if FMT_CPLUSPLUS >= 201703L
30-
# if FMT_HAS_INCLUDE(<filesystem>)
31-
# include <filesystem>
32-
# endif
3330
# if FMT_HAS_INCLUDE(<variant>)
3431
# include <variant>
3532
# endif
@@ -79,6 +76,7 @@
7976
#endif
8077

8178
#if FMT_CPP_LIB_FILESYSTEM
79+
# include <filesystem>
8280
FMT_BEGIN_NAMESPACE
8381

8482
namespace detail {

0 commit comments

Comments
 (0)