From 7b4ccb5f840157fe9bfc1f0840475b1376e4eafc Mon Sep 17 00:00:00 2001
From: Francois Keith <keith@lirmm.fr>
Date: Tue, 28 Aug 2012 13:15:11 +0200
Subject: [PATCH] Compatibility with boost>1.46.1

Correct issues with filesystem.
---
 src/dynamic.cpp | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/dynamic.cpp b/src/dynamic.cpp
index b482da7..3ce2d98 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,
-- 
GitLab