Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace deprecated rcpputils filesystem with std::filesystem #467

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions grid_map_ros/test/GridMapRosTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include <nav_msgs/msg/occupancy_grid.hpp>
#include <nav2_msgs/msg/costmap.hpp>
#include <sensor_msgs/image_encodings.hpp>
#include <rcpputils/filesystem_helper.hpp>

// STD
#include <filesystem>
#include <string>
#include <vector>
#include <iterator>
Expand Down Expand Up @@ -77,9 +77,9 @@ TEST(RosbagHandling, saveLoad)
EXPECT_FALSE(gridMapOut.exists(layer));

// Cleaning in case the previous bag was not removed
rcpputils::fs::path dir(pathToBag);
EXPECT_TRUE(!dir.exists() || rcpputils::fs::remove_all(dir));
EXPECT_TRUE(!dir.exists() || rcpputils::fs::create_directories(dir));
std::filesystem::path dir(pathToBag);
EXPECT_TRUE(!std::filesystem::exists(dir) || std::filesystem::remove_all(dir));
EXPECT_TRUE(!std::filesystem::exists(dir) || std::filesystem::create_directories(dir));

EXPECT_TRUE(GridMapRosConverter::saveToBag(gridMapIn, pathToBag, topic));
EXPECT_TRUE(GridMapRosConverter::loadFromBag(pathToBag, topic, gridMapOut));
Expand All @@ -90,7 +90,7 @@ TEST(RosbagHandling, saveLoad)
}

// Removing the created bag
rcpputils::fs::remove_all(dir);
std::filesystem::remove_all(dir);
}

TEST(RosbagHandling, saveLoadWithTime)
Expand All @@ -115,9 +115,9 @@ TEST(RosbagHandling, saveLoadWithTime)
gridMapIn.setTimestamp(clock.now().nanoseconds());

// Cleaning in case the previous bag was not removed
rcpputils::fs::path dir(pathToBag);
EXPECT_TRUE(!dir.exists() || rcpputils::fs::remove_all(dir));
EXPECT_TRUE(!dir.exists() || rcpputils::fs::create_directories(dir));
std::filesystem::path dir(pathToBag);
EXPECT_TRUE(!std::filesystem::exists(dir) || std::filesystem::remove_all(dir));
EXPECT_TRUE(!std::filesystem::exists(dir) || std::filesystem::create_directories(dir));

EXPECT_TRUE(GridMapRosConverter::saveToBag(gridMapIn, pathToBag, topic));
EXPECT_TRUE(GridMapRosConverter::loadFromBag(pathToBag, topic, gridMapOut));
Expand All @@ -129,7 +129,7 @@ TEST(RosbagHandling, saveLoadWithTime)
}

// Removing the created bag
rcpputils::fs::remove_all(dir);
std::filesystem::remove_all(dir);
}

TEST(RosbagHandling, wrongTopicType)
Expand All @@ -140,7 +140,7 @@ TEST(RosbagHandling, wrongTopicType)
std::string pathToBag = "double_chatter";
string topic = "/chatter1";
GridMap gridMapOut;
rcpputils::fs::path dir(pathToBag);
std::filesystem::path dir(pathToBag);

EXPECT_FALSE(GridMapRosConverter::loadFromBag(pathToBag, topic, gridMapOut));
}
Expand All @@ -155,7 +155,7 @@ TEST(RosbagHandling, checkTopicTypes)
string topic_correct = "/grid_map";
string topic_non_existing = "/grid_map_non_existing";
GridMap gridMapOut;
rcpputils::fs::path dir(pathToBag);
std::filesystem::path dir(pathToBag);

EXPECT_FALSE(GridMapRosConverter::loadFromBag(pathToBag, topic_wrong, gridMapOut));
EXPECT_TRUE(GridMapRosConverter::loadFromBag(pathToBag, topic_correct, gridMapOut));
Expand Down