diff --git a/src/dynamic.cpp b/src/dynamic.cpp index b482da7464c4e35c1eabf54b1dcfc418ea1866d1..3ce2d98fefcd0ccd88a3faf7699c9098cfce4a1b 100644 --- a/src/dynamic.cpp +++ b/src/dynamic.cpp @@ -21,6 +21,7 @@ #include <sot/core/debug.hh> #include <sot-dynamic/dynamic.h> +#include <boost/version.hpp> #include <boost/filesystem.hpp> #include <boost/format.hpp> @@ -494,7 +495,9 @@ setXmlRankFile( const std::string& filename ) // Helper macro for Dynamic::parseConfigFiles(). // Check that all required files exist or throw an exception // otherwise. -#define CHECK_FILE(PATH, FILE_DESCRIPTION) \ +#if BOOST_VERSION < 104601 + +# define CHECK_FILE(PATH, FILE_DESCRIPTION) \ do \ { \ if (!boost::filesystem::exists (PATH) \ @@ -510,6 +513,26 @@ setXmlRankFile( const std::string& filename ) } \ while (0) +#else + +# define CHECK_FILE(PATH, FILE_DESCRIPTION) \ + do \ + { \ + if (!boost::filesystem::exists (PATH) \ + || boost::filesystem::is_directory (PATH)) \ + { \ + boost::format fmt ("Failed to open the %s (%s)."); \ + fmt % (FILE_DESCRIPTION) % robotModelPath.string (); \ + \ + SOT_THROW ExceptionDynamic \ + (ExceptionDynamic::DYNAMIC_JRL, \ + fmt.str ()); \ + } \ + } \ + while (0) + +#endif // BOOST_VERSION < 104600 + void Dynamic::parseConfigFiles() { sotDEBUGIN(15); @@ -528,10 +551,15 @@ void Dynamic::parseConfigFiles() try { sotDEBUG(35) << "Parse the vrml."<<endl; - +#if BOOST_VERSION < 104600 std::string robotModelPathStr (robotModelPath.file_string()); std::string xmlRankPathStr (xmlRankPath.file_string()); std::string xmlSpecificityPathStr (xmlSpecificityPath.file_string()); +#else + std::string robotModelPathStr (robotModelPath.string()); + std::string xmlRankPathStr (xmlRankPath.string()); + std::string xmlSpecificityPathStr (xmlSpecificityPath.string()); +#endif //BOOST_VERSION < 104600 djj::parseOpenHRPVRMLFile (*m_HDR, robotModelPathStr,