Make Cycles compatible with older boost versions.
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 25 Jul 2012 20:25:47 +0000 (20:25 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 25 Jul 2012 20:25:47 +0000 (20:25 +0000)
Patch by IRIE Shinsuke, thanks!

intern/cycles/util/util_cache.cpp
intern/cycles/util/util_path.cpp

index 2924ed30b8816e6424f0af7c7f14fcfe0ab8aee6..d09e256c891a33ad5208b0359491f2d7737a958a 100644 (file)
 #include "util_path.h"
 #include "util_types.h"
 
+#if (BOOST_VERSION < 104400)
+#  define BOOST_FILESYSTEM_VERSION 2
+#endif
+
 #include <boost/filesystem.hpp> 
 #include <boost/algorithm/string.hpp>
 
@@ -115,7 +119,11 @@ void Cache::clear_except(const string& name, const set<string>& except)
                boost::filesystem::directory_iterator it(dir), it_end;
 
                for(; it != it_end; it++) {
+#if (BOOST_FILESYSTEM_VERSION == 2)
+                       string filename = it->path().filename();
+#else
                        string filename = it->path().filename().string();
+#endif
 
                        if(boost::starts_with(filename, name))
                                if(except.find(filename) == except.end())
index 53dbfe9a42c8b1d205bba7e5417b9eb836e0e52f..f6b70bfb73ff7424e4c0e064c300b468764576a7 100644 (file)
@@ -26,6 +26,10 @@ OIIO_NAMESPACE_USING
 
 #include <stdio.h>
 
+#if (BOOST_VERSION < 104400)
+#  define BOOST_FILESYSTEM_VERSION 2
+#endif
+
 #include <boost/filesystem.hpp> 
 #include <boost/algorithm/string.hpp>
 
@@ -58,7 +62,11 @@ string path_user_get(const string& sub)
 
 string path_filename(const string& path)
 {
+#if (BOOST_FILESYSTEM_VERSION == 2)
+       return boost::filesystem::path(path).filename();
+#else
        return boost::filesystem::path(path).filename().string();
+#endif
 }
 
 string path_dirname(const string& path)