From 426eded7b0cf7514fb3e0ff7dcca207fdf98bc85 Mon Sep 17 00:00:00 2001 From: Stephen Roderick Date: Sun, 28 Aug 2011 16:03:43 -0400 Subject: [PATCH] Patches for boost filesystem v3 --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 1 + src/configsearch/configuration_finder.cc | 1 + src/system/process.cc | 8 ++++++++ 4 files changed, 11 insertions(+), 1 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6973ecf..72f0f8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ SET(API_VERSION 1) set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") FIND_PACKAGE(Boost COMPONENTS unit_test_framework) -FIND_PACKAGE(Boost REQUIRED graph filesystem thread regex) +FIND_PACKAGE(Boost REQUIRED graph filesystem thread regex system) include_directories(${CMAKE_BINARY_DIR}) # to get cmake-generated utilmm/config/config.h include_directories(${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8ba00ce..ac4e0d6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,6 +21,7 @@ set_target_properties(utilmm PROPERTIES target_link_libraries(utilmm ${Boost_REGEX_LIBRARY}) target_link_libraries(utilmm ${Boost_THREAD_LIBRARY}) target_link_libraries(utilmm ${Boost_FILESYSTEM_LIBRARY}) +target_link_libraries(utilmm ${Boost_SYSTEM_LIBRARY}) install(TARGETS utilmm RUNTIME DESTINATION bin diff --git a/src/configsearch/configuration_finder.cc b/src/configsearch/configuration_finder.cc index 051d016..17f972f 100644 --- a/src/configsearch/configuration_finder.cc +++ b/src/configsearch/configuration_finder.cc @@ -4,6 +4,7 @@ #include #include #include +#include namespace utilmm { diff --git a/src/system/process.cc b/src/system/process.cc index 5d13a51..9566243 100644 --- a/src/system/process.cc +++ b/src/system/process.cc @@ -157,7 +157,11 @@ void process::killall() void process::erase_redirection(Stream stream) { redirect_to(stream, ""); } void process::redirect_to( Stream stream, boost::filesystem::path const& file) { +#if (3==BOOST_FILESYSTEM_VERSION) + int handle = open(file.string().c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0666); +#else int handle = open(file.native_file_string().c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0666); +#endif if (handle == -1) throw unix_error(); @@ -256,7 +260,11 @@ void process::start() if (!m_wdir.empty()) { +#if (3==BOOST_FILESYSTEM_VERSION) + if (chdir(m_wdir.string().c_str()) == -1) +#else if (chdir(m_wdir.native_file_string().c_str()) == -1) +#endif send_child_error(pc_comm[1], CHDIR_ERROR); } -- 1.7.4.4