6 #include <boost/filesystem.hpp>
7 #include "pinocchio/utils/file-explorer.hpp"
9 namespace fs = boost::filesystem;
14 std::vector<std::string> & list_of_paths,
15 const std::string & delimiter)
17 const char * env_var_value = std::getenv(env_var_name.c_str());
19 if(env_var_value != NULL)
21 std::string policyStr(env_var_value);
23 policyStr += delimiter;
24 size_t lastOffset = 0;
27 size_t offset = policyStr.find_first_of(delimiter, lastOffset);
28 if (offset < policyStr.size())
29 list_of_paths.push_back(policyStr.substr(lastOffset, offset - lastOffset));
30 if (offset == std::string::npos)
33 lastOffset = offset + 1;
39 const std::string & delimiter)
41 std::vector<std::string> list_of_paths;
47 const std::string & suffix)
49 for (
size_t i = 0; i < list_of_paths.size(); ++i)
51 list_of_paths[i] += suffix;
57 std::vector<std::string> raw_list_of_paths;
58 std::vector<std::string> raw_list_of_prefixes;
63 raw_list_of_paths.insert(raw_list_of_paths.end(), raw_list_of_prefixes.begin(),
64 raw_list_of_prefixes.end());
69 std::vector<std::string> list_of_paths;
70 for (std::vector<std::string>::iterator it = raw_list_of_paths.begin(); it != raw_list_of_paths.end(); ++it) {
71 list_of_paths.push_back(*it);
73 if (fs::exists(path /
"package.xml")) {
74 list_of_paths.push_back(fs::path(path /
"..").
string());