From 166096f2c0dc2edc76ff498502008da9852ae3e2 Mon Sep 17 00:00:00 2001 From: Andreas Rid Date: Tue, 11 Sep 2012 23:24:42 +0200 Subject: [PATCH] Add support for boost filesystem version 3 Boost filesystem version 2 is deprecated in boot-1.50. --- CMakeLists.txt | 2 +- src/common.cc | 6 +++--- src/config.cc | 2 +- src/device.cc | 8 ++++---- src/e4rat-collect.cc | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6de8d2..65aa95d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED OFF) -add_definitions(-DBOOST_FILESYSTEM_VERSION=2) +add_definitions(-DBOOST_FILESYSTEM_VERSION=3) find_package(Boost 1.41 COMPONENTS system filesystem regex REQUIRED) set(${PROJECT_NAME}_LIBRARIES ${${PROJECT_NAME}_LIBRARIES} ${Boost_LIBRARIES}) diff --git a/src/common.cc b/src/common.cc index 9fba13a..f907fa4 100644 --- a/src/common.cc +++ b/src/common.cc @@ -157,7 +157,7 @@ std::vector matchPath( const std::string & filesearch ) p /= filesearch; } // Initialize regex filter - use * as default if nothing is given in filesearch - std::string f( p.has_filename() ? p.filename() : "*"); + std::string f( p.has_filename() ? p.filename().string() : "*"); fs::path dir(system_complete(p).parent_path()); if( is_directory(dir) ) @@ -166,8 +166,8 @@ std::vector matchPath( const std::string & filesearch ) it!=boost::filesystem::directory_iterator(); ++it ) { - if( boost::regex_match( it->leaf(), path2regex(f) ) ) - fileset.push_back(it->string()); + if( boost::regex_match( it->path().string(), path2regex(f) ) ) + fileset.push_back(it->path().string()); } return fileset; } diff --git a/src/config.cc b/src/config.cc index 5671fb4..8841c5d 100644 --- a/src/config.cc +++ b/src/config.cc @@ -71,7 +71,7 @@ Config::Config() return; } - tool_name = fs::path(argv[0]).filename(); + tool_name = fs::path(argv[0]).filename().string(); found = tool_name.find_last_of("-"); if(found) defaultSection = tool_name.substr(found+1); diff --git a/src/device.cc b/src/device.cc index 4ac6e73..e366cdb 100644 --- a/src/device.cc +++ b/src/device.cc @@ -196,13 +196,13 @@ int Device::getDevNameFromDevfs() it != end_itr; ++it ) { - if(it->filename() == "root") + if(it->path().string() == "root") continue; - if(lstat(it->string().c_str(), &st)) + if(lstat(it->path().string().c_str(), &st)) continue; if(st.st_rdev == get()->devno) { - get()->deviceName = it->filename(); + get()->deviceName = it->path().string(); get()->devicePath = "/dev/" + get()->deviceName; return 0; } @@ -225,7 +225,7 @@ int Device::getDevNameFromMajorMinor() // the minor number of virtual filesystems are allocated dynamically in function set_anon_super() in fs/super.c // for convenience set deviceName and devicePath to a common name get()->deviceName = "virtual file system"; - get()->devicePath = get()->mount_point.filename(); + get()->devicePath = get()->mount_point.filename().string(); return 0; case 2: ss << "fd"; diff --git a/src/e4rat-collect.cc b/src/e4rat-collect.cc index 8cc2b81..455057c 100644 --- a/src/e4rat-collect.cc +++ b/src/e4rat-collect.cc @@ -396,7 +396,7 @@ int main(int argc, char* argv[]) * Parse application list given as arguments */ for ( ; optind < argc; optind++) - project.observeApp(fs::path(argv[optind]).filename()); + project.observeApp(fs::path(argv[optind]).filename().string()); /* * Parse application list on stdin -- 1.7.4.1