5 #ifndef __pinocchio_file_explorer_hpp__ 6 #define __pinocchio_file_explorer_hpp__ 23 inline std::vector<std::string>
extractPathFromEnvVar(
const std::string & env_var_name,
const std::string & delimiter =
":")
25 const char * env_var_value = std::getenv(env_var_name.c_str());
26 std::vector<std::string> env_var_paths;
28 if (env_var_value != NULL)
30 std::string policyStr (env_var_value);
32 policyStr += std::string (
":");
33 size_t lastOffset = 0;
37 size_t offset = policyStr.find_first_of(delimiter, lastOffset);
38 if (offset < policyStr.size())
39 env_var_paths.push_back(policyStr.substr(lastOffset, offset - lastOffset));
40 if (offset == std::string::npos)
43 lastOffset = offset + 1;
63 #endif // __pinocchio_file_explorer_hpp__ std::vector< std::string > rosPaths()
Parse the environment variable ROS_PACKAGE_PATH and extract paths.
std::vector< std::string > extractPathFromEnvVar(const std::string &env_var_name, const std::string &delimiter=":")
Parse an environment variable if exists and extract paths according to the delimiter.
Main pinocchio namespace.