12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #ifndef BOOST_IOSTREAMS_DETAIL_ABSOLUTE_PATH_HPP_INCLUDED
- #define BOOST_IOSTREAMS_DETAIL_ABSOLUTE_PATH_HPP_INCLUDED
- #include <string>
- #include <boost/iostreams/detail/config/windows_posix.hpp>
- #ifdef BOOST_IOSTREAMS_WINDOWS
- # include <cctype>
- #endif
- #include <boost/iostreams/detail/current_directory.hpp>
- namespace boost { namespace iostreams { namespace detail {
- inline std::string absolute_path(const std::string& path)
- {
- #ifdef BOOST_IOSTREAMS_WINDOWS
- return path.size() && (path[0] == '/' || path[0] == '\\') ||
- path.size() > 1 && std::isalpha(path[0]) && path[1] == ':' ?
- path :
- current_directory() + '\\' + path;
- #else
- return path.size() && (path[0] == '/') ?
- path :
- current_directory() + '/' + path;
- #endif
- }
- } } }
- #endif
|