FileSystem.h 891 B

123456789101112131415161718192021222324252627
  1. #if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
  2. // Shim header for filesystem for compilers that are too old to have it not
  3. // in the experimental namespace
  4. #if __has_include(<filesystem>)
  5. #include <filesystem>
  6. #elif __has_include(<experimental/filesystem>)
  7. #include <experimental/filesystem>
  8. #else
  9. #error "Neither <filesystem> nor <experimental/filesystem> is available."
  10. #endif
  11. namespace c10 {
  12. #if __has_include(<filesystem>)
  13. // NOLINTNEXTLINE(misc-unused-alias-decls)
  14. namespace filesystem = std::filesystem;
  15. #elif __has_include(<experimental/filesystem>)
  16. // NOLINTNEXTLINE(misc-unused-alias-decls)
  17. namespace filesystem = std::experimental::filesystem;
  18. #endif
  19. } // namespace c10
  20. #else
  21. #error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
  22. #endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)