23 #include <boost/filesystem.hpp> 30 static std::map<std::string, std::string> package_cache;
31 std::string uri = path;
33 if (uri.find(
"file://") == 0)
36 uri.erase(0, strlen(
"file://"));
39 boost::filesystem::path file_path(uri);
40 return file_path.string();
42 else if (uri.find(
"package://") == 0)
45 uri.erase(0, strlen(
"package://"));
48 size_t package_end = uri.find(
"/");
49 std::string
package = uri.substr(0, package_end);
50 std::string package_path;
53 std::map<std::string, std::string>::iterator it = package_cache.find(
package);
54 if (it != package_cache.end())
56 package_path = it->second;
61 package_cache[
package] = package_path;
65 if (package_path.empty())
72 boost::filesystem::path file_path(package_path);
73 uri.erase(0, package_end);
77 return file_path.string();
81 ROS_ERROR(
"Cannot handle mesh URI type [%s].", uri.c_str());
const std::string resolveURI(const std::string &path)
ROSLIB_DECL std::string getPath(const std::string &package_name)