summaryrefslogtreecommitdiff
path: root/boost/wave/util/filesystem_compatibility.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/wave/util/filesystem_compatibility.hpp')
-rw-r--r--boost/wave/util/filesystem_compatibility.hpp75
1 files changed, 49 insertions, 26 deletions
diff --git a/boost/wave/util/filesystem_compatibility.hpp b/boost/wave/util/filesystem_compatibility.hpp
index 5bd924af72..157c6418c0 100644
--- a/boost/wave/util/filesystem_compatibility.hpp
+++ b/boost/wave/util/filesystem_compatibility.hpp
@@ -3,7 +3,7 @@
http://www.boost.org/
- Copyright (c) 2001-2011 Hartmut Kaiser. Distributed under the Boost
+ Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
@@ -25,12 +25,12 @@ namespace boost { namespace wave { namespace util
// interface wrappers for older Boost versions
inline boost::filesystem::path initial_path()
{
- return boost::filesystem::initial_path();
+ return boost::filesystem::initial_path();
}
inline boost::filesystem::path current_path()
{
- return boost::filesystem::current_path();
+ return boost::filesystem::current_path();
}
template <typename String>
@@ -43,18 +43,18 @@ namespace boost { namespace wave { namespace util
#endif
}
- inline std::string leaf(boost::filesystem::path const& p)
- {
+ inline std::string leaf(boost::filesystem::path const& p)
+ {
#if BOOST_FILESYSTEM_VERSION >= 3
- return p.leaf().string();
+ return p.leaf().string();
#else
- return p.leaf();
+ return p.leaf();
#endif
}
- inline boost::filesystem::path branch_path(boost::filesystem::path const& p)
- {
- return p.branch_path();
+ inline boost::filesystem::path branch_path(boost::filesystem::path const& p)
+ {
+ return p.branch_path();
}
inline boost::filesystem::path normalize(boost::filesystem::path& p)
@@ -62,12 +62,12 @@ namespace boost { namespace wave { namespace util
return p.normalize();
}
- inline std::string native_file_string(boost::filesystem::path const& p)
- {
+ inline std::string native_file_string(boost::filesystem::path const& p)
+ {
#if BOOST_FILESYSTEM_VERSION >= 3
- return p.string();
+ return p.string();
#else
- return p.native_file_string();
+ return p.native_file_string();
#endif
}
@@ -75,7 +75,11 @@ namespace boost { namespace wave { namespace util
boost::filesystem::path const& p)
{
#if BOOST_FILESYSTEM_VERSION >= 3
+#if BOOST_VERSION >= 105000
+ return boost::filesystem::complete(p, initial_path());
+#else
return boost::filesystem3::complete(p, initial_path());
+#endif
#else
return boost::filesystem::complete(p, initial_path());
#endif
@@ -85,7 +89,11 @@ namespace boost { namespace wave { namespace util
boost::filesystem::path const& p, boost::filesystem::path const& base)
{
#if BOOST_FILESYSTEM_VERSION >= 3
+#if BOOST_VERSION >= 105000
+ return boost::filesystem::complete(p, base);
+#else
return boost::filesystem3::complete(p, base);
+#endif
#else
return boost::filesystem::complete(p, base);
#endif
@@ -95,18 +103,26 @@ namespace boost { namespace wave { namespace util
// interface wrappers if deprecated functions do not exist
inline boost::filesystem::path initial_path()
- {
+ {
#if BOOST_FILESYSTEM_VERSION >= 3
+#if BOOST_VERSION >= 105000
+ return boost::filesystem::detail::initial_path();
+#else
return boost::filesystem3::detail::initial_path();
+#endif
#else
return boost::filesystem::initial_path<boost::filesystem::path>();
#endif
}
inline boost::filesystem::path current_path()
- {
+ {
#if BOOST_FILESYSTEM_VERSION >= 3
+#if BOOST_VERSION >= 105000
+ return boost::filesystem::current_path();
+#else
return boost::filesystem3::current_path();
+#endif
#else
return boost::filesystem::current_path<boost::filesystem::path>();
#endif
@@ -118,18 +134,18 @@ namespace boost { namespace wave { namespace util
return boost::filesystem::path(p);
}
- inline std::string leaf(boost::filesystem::path const& p)
- {
+ inline std::string leaf(boost::filesystem::path const& p)
+ {
#if BOOST_VERSION >= 104600 && BOOST_FILESYSTEM_VERSION >= 3
return p.filename().string();
#else
- return p.filename();
+ return p.filename();
#endif
}
- inline boost::filesystem::path branch_path(boost::filesystem::path const& p)
- {
- return p.parent_path();
+ inline boost::filesystem::path branch_path(boost::filesystem::path const& p)
+ {
+ return p.parent_path();
}
inline boost::filesystem::path normalize(boost::filesystem::path& p)
@@ -137,12 +153,12 @@ namespace boost { namespace wave { namespace util
return p; // function doesn't exist anymore
}
- inline std::string native_file_string(boost::filesystem::path const& p)
- {
+ inline std::string native_file_string(boost::filesystem::path const& p)
+ {
#if BOOST_VERSION >= 104600
- return p.string();
+ return p.string();
#else
- return p.file_string();
+ return p.file_string();
#endif
}
@@ -167,6 +183,13 @@ namespace boost { namespace wave { namespace util
}
#endif
+ // starting withBoost V1.50 create_directories throws if given an empty path
+ inline bool create_directories(boost::filesystem::path const& p)
+ {
+ if (p.string().empty())
+ return true;
+ return boost::filesystem::create_directories(p);
+ }
}}}
#endif