Skip to content

Commit de08133

Browse files
authored
Migrate boost filesystem to std filesystem (#253)
1 parent a6e1744 commit de08133

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Install boost, curl and lcov
1111
run: |
1212
sudo apt-get update
13-
sudo apt-get install -yq libcurl4-openssl-dev libboost-system1.71-dev libboost-filesystem1.71-dev libboost-test1.71-dev libboost-program-options1.71-dev lcov
13+
sudo apt-get install -yq libcurl4-openssl-dev libboost-system1.71-dev libboost-test1.71-dev libboost-program-options1.71-dev lcov
1414
- name: Run CMake
1515
run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Debug
1616
- name: Build project

CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ endif()
1717

1818
# Define project
1919
project(Monitoring
20-
VERSION 3.8.5
20+
VERSION 3.8.6
2121
DESCRIPTION "O2 Monitoring library"
2222
LANGUAGES CXX
2323
)
@@ -59,7 +59,7 @@ endif()
5959

6060
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
6161

62-
find_package(Boost REQUIRED COMPONENTS unit_test_framework program_options system filesystem)
62+
find_package(Boost REQUIRED COMPONENTS unit_test_framework program_options system)
6363
find_package(ApMon MODULE)
6464
find_package(CURL MODULE)
6565
find_package(RdKafka CONFIG)
@@ -137,7 +137,6 @@ target_link_libraries(Monitoring
137137
Boost::boost
138138
PRIVATE
139139
Boost::system
140-
Boost::filesystem
141140
pthread
142141
$<$<BOOL:${ApMon_FOUND}>:ApMon::ApMon>
143142
$<$<BOOL:${RdKafka_FOUND}>:RdKafka::rdkafka++>
@@ -241,7 +240,7 @@ foreach (test ${TEST_SRCS})
241240
add_executable(${test_name} ${test})
242241
target_link_libraries(${test_name}
243242
PRIVATE
244-
Monitoring Boost::unit_test_framework Boost::filesystem
243+
Monitoring Boost::unit_test_framework
245244
)
246245
add_test(NAME ${test_name} COMMAND ${test_name})
247246
set_tests_properties(${test_name} PROPERTIES TIMEOUT 60)

src/Transports/Unix.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include "Unix.h"
1717
#include <string>
18-
#include <boost/filesystem.hpp>
18+
#include <filesystem>
1919
#include "../MonLogger.h"
2020

2121
namespace o2
@@ -29,7 +29,7 @@ namespace transports
2929
#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
3030
Unix::Unix(const std::string& socketPath) : mSocket(mIoService), mEndpoint(socketPath)
3131
{
32-
if (!boost::filesystem::exists(socketPath)) {
32+
if (!std::filesystem::exists(socketPath)) {
3333
MonLogger::Get(Severity::Error) << "Unix socket path is invalid: " << socketPath << MonLogger::End();
3434
} else {
3535
mSocket.open();

test/testMonitoringFactory.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
#define BOOST_TEST_DYN_LINK
1616
#include <boost/test/unit_test.hpp>
1717
#include <boost/lexical_cast.hpp>
18-
#include <boost/filesystem/path.hpp>
19-
#include <boost/filesystem/operations.hpp>
18+
#include <filesystem>
2019

2120
#include "../include/Monitoring/MonitoringFactory.h"
2221

@@ -52,7 +51,7 @@ BOOST_AUTO_TEST_CASE(Noop)
5251
#ifdef O2_MONITORING_WITH_APPMON
5352
BOOST_AUTO_TEST_CASE(ApMon)
5453
{
55-
boost::filesystem::path configPath = boost::filesystem::canonical(".");
54+
std::filesystem::path configPath = std::filesystem::canonical(".");
5655
auto Monitoring = MonitoringFactory::Get("apmon://" + configPath.string() + "/ApMon.conf");
5756
monitoring->send({10, "myCrazyMetric"});
5857
}

0 commit comments

Comments
 (0)