From: Joel Holdsworth Date: Sat, 1 Mar 2014 10:49:05 +0000 (+0000) Subject: Use boost::filesystem::path to get the filename from a path X-Git-Tag: pulseview-0.2.0~45 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=03e8c9914eeadadd6f54aa32f55f5c08bd27c426;p=pulseview.git Use boost::filesystem::path to get the filename from a path --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ebff3729..1b9c7d1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,9 +80,9 @@ find_package(Threads) if(WIN32) # On Windows/MinGW we need to use 'thread_win32' instead of 'thread'. # The library is named libboost_thread_win32* (not libboost_thread*). - find_package(Boost 1.42 COMPONENTS system thread_win32 REQUIRED) + find_package(Boost 1.42 COMPONENTS filesystem system thread_win32 REQUIRED) else() - find_package(Boost 1.42 COMPONENTS system thread REQUIRED) + find_package(Boost 1.42 COMPONENTS filesystem system thread REQUIRED) endif() #=============================================================================== diff --git a/pv/device/file.cpp b/pv/device/file.cpp index 190b5384..e33be854 100644 --- a/pv/device/file.cpp +++ b/pv/device/file.cpp @@ -22,6 +22,8 @@ #include "inputfile.h" #include "sessionfile.h" +#include + #include using std::string; @@ -36,7 +38,7 @@ File::File(const std::string path) : std::string File::format_device_title() const { - return _path; + return boost::filesystem::path(_path).filename().string(); } File* File::create(const string &name) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 66dd7e51..98d8619c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -36,9 +36,9 @@ find_package(Threads) if(WIN32) # On Windows/MinGW we need to use 'thread_win32' instead of 'thread'. # The library is named libboost_thread_win32* (not libboost_thread*). - find_package(Boost 1.42 COMPONENTS system thread_win32 unit_test_framework REQUIRED) + find_package(Boost 1.42 COMPONENTS filesystem system thread_win32 unit_test_framework REQUIRED) else() - find_package(Boost 1.42 COMPONENTS system thread unit_test_framework REQUIRED) + find_package(Boost 1.42 COMPONENTS filesystem system thread unit_test_framework REQUIRED) endif()