18 #ifndef __se3_parsers_utils_hpp__    19 #define __se3_parsers_utils_hpp__    26 #include <boost/filesystem/fstream.hpp>    27 #include <boost/foreach.hpp>    28 #include <boost/format.hpp>    30 #include "pinocchio/utils/file-explorer.hpp"    31 #include <boost/filesystem.hpp>    55     const std::string extension = filename.substr(filename.find_last_of(
".") + 1);
    57     if (extension == 
"urdf")
    59     else if (extension == 
"lua")
    78                                            const std::vector<std::string> & package_dirs) 
throw (std::invalid_argument)
    81     namespace bf = boost::filesystem;
    82     std::string result_path;
    84     const std::string separator(
"://");
    85     const std::size_t pos_separator = 
string.find(separator);
    87     if (pos_separator != std::string::npos)
    89       std::string scheme = 
string.substr(0, pos_separator);
    90       std::string path = 
string.substr(pos_separator+3, std::string::npos);
    92       if(scheme == 
"package")
    99         for (std::size_t i = 0; i < package_dirs.size(); ++i)
   101           if ( bf::exists( bf::path(package_dirs[i] + 
"/" + path)))
   103             result_path = std::string( package_dirs[i] + 
"/" + path );
   108       else if (scheme == 
"file")
   114         const std::string exception_message (
"Schemes of form" + scheme + 
"are not handled");
   115         throw std::invalid_argument(exception_message);
   120       result_path = string;
   128 #endif // __se3_parsers_utils_hpp__ 
ModelFileExtensionType checkModelFileExtension(const std::string &filename)
Extract the type of the given model file according to its extension. 
 
std::string retrieveResourcePath(const std::string &string, const std::vector< std::string > &package_dirs)
Retrieve the path of the file whose path is given in an url-format. Currently convert from the folliw...
 
ModelFileExtensionType
Supported model file extensions.