Skip to content

Commit

Permalink
Use std::filesystem instead of rcpputils::fs functions
Browse files Browse the repository at this point in the history
- Rationale: Deprecation of the rcpputils::fs in future
See ros2/rcpputils#164 for details

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
  • Loading branch information
MichaelOrlov committed Nov 7, 2023
1 parent ef4c2c4 commit 975e075
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <gmock/gmock.h>

#include <chrono>
#include <filesystem>
#include <string>

#include "rosbag2_cpp/info.hpp"
Expand Down Expand Up @@ -52,17 +53,17 @@ class Rosbag2CPPGetServiceInfoTest
void SetUp() override
{
auto bag_name = get_test_name() + "_" + GetParam();
root_bag_path_ = rcpputils::fs::path(temporary_dir_path_) / bag_name;
root_bag_path_ = std::filesystem::path(temporary_dir_path_) / bag_name;

// Clean up potentially leftover bag files.
// There may be leftovers if the system reallocates a temp directory
// used by a previous test execution and the test did not have a clean exit.
rcpputils::fs::remove_all(root_bag_path_);
std::filesystem::remove_all(root_bag_path_);
}

void TearDown() override
{
rcpputils::fs::remove_all(root_bag_path_);
std::filesystem::remove_all(root_bag_path_);
}

static void SetUpTestCase()
Expand Down Expand Up @@ -116,7 +117,7 @@ class Rosbag2CPPGetServiceInfoTest

std::string get_bag_path_str() const
{
return root_bag_path_.string();
return root_bag_path_.generic_string();
}

bool wait_for_subscriptions(
Expand All @@ -142,7 +143,7 @@ class Rosbag2CPPGetServiceInfoTest
}

// relative path to the root of the bag file.
rcpputils::fs::path root_bag_path_;
std::filesystem::path root_bag_path_;
std::future<void> node_spinner_future_;
std::atomic_bool exit_from_node_spinner_{false};
};
Expand Down

0 comments on commit 975e075

Please sign in to comment.