Skip to content

Commit 60b7788

Browse files
Switch from rcpputils::fs to std::filesystem (#254)
Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai>
1 parent 6699fe7 commit 60b7788

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pluginlib/include/pluginlib/class_loader_imp.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#define PLUGINLIB__CLASS_LOADER_IMP_HPP_
3939

4040
#include <cstdlib>
41+
#include <filesystem>
4142
#include <list>
4243
#include <map>
4344
#include <memory>
@@ -52,7 +53,6 @@
5253
#include "ament_index_cpp/get_resource.hpp"
5354
#include "ament_index_cpp/get_resources.hpp"
5455
#include "class_loader/class_loader.hpp"
55-
#include "rcpputils/filesystem_helper.hpp"
5656
#include "rcpputils/shared_library.hpp"
5757
#include "rcutils/logging_macros.h"
5858

@@ -486,7 +486,7 @@ std::string ClassLoader<T>::getClassLibraryPath(const std::string & lookup_name)
486486
library_name.c_str());
487487
for (auto path_it = paths_to_try.begin(); path_it != paths_to_try.end(); path_it++) {
488488
RCUTILS_LOG_DEBUG_NAMED("pluginlib.ClassLoader", "Checking path %s ", path_it->c_str());
489-
if (rcpputils::fs::exists(*path_it)) {
489+
if (std::filesystem::exists(*path_it)) {
490490
RCUTILS_LOG_DEBUG_NAMED("pluginlib.ClassLoader", "Library %s found at explicit path %s.",
491491
library_name.c_str(), path_it->c_str());
492492
return *path_it;
@@ -566,12 +566,12 @@ ClassLoader<T>::getPackageFromPluginXMLFilePath(const std::string & plugin_xml_f
566566
// 2. Extract name of package from package.xml
567567

568568
std::string package_name;
569-
rcpputils::fs::path p(plugin_xml_file_path);
570-
rcpputils::fs::path parent = p.parent_path();
569+
std::filesystem::path p(plugin_xml_file_path);
570+
std::filesystem::path parent = p.parent_path();
571571

572572
// Figure out exactly which package the passed XML file is exported by.
573573
while (true) {
574-
if (rcpputils::fs::exists(parent / "package.xml")) {
574+
if (std::filesystem::exists(parent / "package.xml")) {
575575
std::string package_file_path = (parent / "package.xml").string();
576576
return extractPackageNameFromPackageXML(package_file_path);
577577
}
@@ -594,7 +594,7 @@ template<class T>
594594
std::string ClassLoader<T>::getPathSeparator()
595595
/***************************************************************************/
596596
{
597-
return std::string(1, rcpputils::fs::kPreferredSeparator);
597+
return std::string(1, std::filesystem::path::preferred_separator);
598598
}
599599

600600

@@ -628,7 +628,7 @@ template<class T>
628628
std::string ClassLoader<T>::joinPaths(const std::string & path1, const std::string & path2)
629629
/***************************************************************************/
630630
{
631-
rcpputils::fs::path p1(path1);
631+
std::filesystem::path p1(path1);
632632
return (p1 / path2).string();
633633
}
634634

0 commit comments

Comments
 (0)