Commit 12d25a7a authored by Wolfgang Merkt's avatar Wolfgang Merkt
Browse files

[file-explorer] Restore API + apply Windows support

parent 9df20d30
Pipeline #15162 passed with stage
in 152 minutes and 33 seconds
......@@ -6,18 +6,13 @@
#include <boost/filesystem.hpp>
#include "pinocchio/utils/file-explorer.hpp"
#ifdef _WIN32
const char delimiter = ';';
#else
const char delimiter = ':';
#endif
namespace fs = boost::filesystem;
namespace pinocchio
{
void extractPathFromEnvVar(const std::string & env_var_name,
std::vector<std::string> & list_of_paths)
std::vector<std::string> & list_of_paths,
const std::string & delimiter)
{
const char * env_var_value = std::getenv(env_var_name.c_str());
......@@ -40,10 +35,11 @@ namespace pinocchio
}
}
std::vector<std::string> extractPathFromEnvVar(const std::string & env_var_name)
std::vector<std::string> extractPathFromEnvVar(const std::string & env_var_name,
const std::string & delimiter)
{
std::vector<std::string> list_of_paths;
extractPathFromEnvVar(env_var_name,list_of_paths);
extractPathFromEnvVar(env_var_name,list_of_paths,delimiter);
return list_of_paths;
}
......
......@@ -17,11 +17,18 @@ namespace pinocchio
* @brief Parse an environment variable if exists and extract paths according to the delimiter.
*
* @param[in] env_var_name The name of the environment variable.
* @param[in] delimiter The delimiter between two consecutive paths.
*
* @return The vector of paths extracted from the environment variable value.
*/
PINOCCHIO_DLLAPI std::vector<std::string>
extractPathFromEnvVar(const std::string & env_var_name);
extractPathFromEnvVar(const std::string & env_var_name,
#ifdef _WIN32
const std::string & delimiter = ";"
#else
const std::string & delimiter = ":"
#endif
);
/**
......@@ -29,16 +36,23 @@ namespace pinocchio
*
* @param[in] env_var_name The name of the environment variable.
* @param[out] list_of_paths List of path to fill with the paths extracted from the environment variable value.
* @param[in] delimiter The delimiter between two consecutive paths.
*/
PINOCCHIO_DLLAPI void
extractPathFromEnvVar(const std::string & env_var_name,
std::vector<std::string> & list_of_paths);
std::vector<std::string> & list_of_paths,
#ifdef _WIN32
const std::string & delimiter = ";"
#else
const std::string & delimiter = ":"
#endif
);
/**
* @brief Parse the environment variable ROS_PACKAGE_PATH and extract paths
* @brief Parse the environment variables ROS_PACKAGE_PATH / AMENT_PREFIX_PATH and extract paths
*
* @return The vector of paths extracted from the environment variable ROS_PACKAGE_PATH
* @return The vector of paths extracted from the environment variables ROS_PACKAGE_PATH / AMENT_PREFIX_PATH
*/
PINOCCHIO_DLLAPI std::vector<std::string> rosPaths();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment