Skip to content

Commit

Permalink
Merge pull request ray-project#129 from amplab/filesystem
Browse files Browse the repository at this point in the history
Use std::experimental::filesystem instead of boost::filesystem at least in some cases
  • Loading branch information
robertnishihara authored Jun 20, 2016
2 parents 83145b3 + ce0e4ea commit 4ebdd0e
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/utils.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "utils.h"

#if defined(_CPPLIB_VER) && _CPPLIB_VER >= 650
#include <experimental/filesystem>
#else
#include <boost/filesystem.hpp>
#endif

#include "ray/ray.h"

Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 4ebdd0e

Please sign in to comment.