2 * Distributed under the Boost Software License, Version 1.0.(See accompanying
3 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
5 * See http://www.boost.org/libs/iostreams for documentation.
7 * File: boost/iostreams/detail/execute.hpp
8 * Date: Thu Dec 06 13:21:54 MST 2007
9 * Copyright: 2007-2008 CodeRage, LLC
10 * Author: Jonathan Turkanis
11 * Contact: turkanis at coderage dot com
13 * Defines the function boost::iostreams::detail::absolute_path, used for
14 * debug output for mapped files.
17 #ifndef BOOST_IOSTREAMS_DETAIL_ABSOLUTE_PATH_HPP_INCLUDED
18 #define BOOST_IOSTREAMS_DETAIL_ABSOLUTE_PATH_HPP_INCLUDED
21 #include <boost/iostreams/detail/config/windows_posix.hpp>
22 #ifdef BOOST_IOSTREAMS_WINDOWS
25 #include <boost/iostreams/detail/current_directory.hpp>
27 namespace boost { namespace iostreams { namespace detail {
29 // Resolves the given path relative to the current working directory
30 inline std::string absolute_path(const std::string& path)
32 #ifdef BOOST_IOSTREAMS_WINDOWS
33 return path.size() && (path[0] == '/' || path[0] == '\\') ||
34 path.size() > 1 && std::isalpha(path[0]) && path[1] == ':' ?
36 current_directory() + '\\' + path;
37 #else // #ifdef BOOST_IOSTREAMS_WINDOWS
38 return path.size() && (path[0] == '/') ?
40 current_directory() + '/' + path;
41 #endif // #ifdef BOOST_IOSTREAMS_WINDOWS
44 } } } // End namespaces detail, iostreams, boost.
46 #endif // #ifndef BOOST_IOSTREAMS_DETAIL_ABSOLUTE_PATH_HPP_INCLUDED