From ce0e4eabb36adcf2371d235cc12421bd699b7323 Mon Sep 17 00:00:00 2001 From: Mehrdad Date: Sun, 19 Jun 2016 20:35:04 -0700 Subject: [PATCH] std::experimental::filesystem --- src/utils.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/utils.cc b/src/utils.cc index ba5e85989..c0110aa50 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -1,6 +1,10 @@ #include "utils.h" +#if defined(_CPPLIB_VER) && _CPPLIB_VER >= 650 +#include +#else #include +#endif #include "ray/ray.h" @@ -30,9 +34,16 @@ const char* get_cmd_option(char** begin, char** end, const std::string& option) } void create_log_dir_or_die(const char* log_file_name) { - boost::filesystem::path log_file_path(log_file_name); - boost::system::error_code returned_error; - boost::filesystem::create_directories(log_file_path.parent_path(), returned_error); +#ifdef BOOST_FILESYSTEM_FILESYSTEM_HPP + namespace filesystem = boost::filesystem; + typedef boost::system::error_code error_code; +#else + namespace filesystem = std::experimental::filesystem; + typedef std::error_code error_code; +#endif + filesystem::path log_file_path(log_file_name); + error_code returned_error; + filesystem::create_directories(log_file_path.parent_path(), returned_error); if (returned_error) { RAY_CHECK(false, "Failed to create directory for " << log_file_name); }