filesystem.hpp 830 B

123456789101112131415161718192021222324252627
  1. //
  2. // Copyright (c) 2012 Artyom Beilis (Tonkikh)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See
  5. // accompanying file LICENSE or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. #ifndef BOOST_NOWIDE_INTEGRATION_FILESYSTEM_HPP_INCLUDED
  9. #define BOOST_NOWIDE_INTEGRATION_FILESYSTEM_HPP_INCLUDED
  10. #include <boost/nowide/utf8_codecvt.hpp>
  11. #include <boost/filesystem/path.hpp>
  12. namespace boost {
  13. namespace nowide {
  14. ///
  15. /// Install utf8_codecvt facet into boost::filesystem::path such all char strings are interpreted as utf-8 strings
  16. ///
  17. inline std::locale nowide_filesystem()
  18. {
  19. std::locale tmp = std::locale(std::locale(), new boost::nowide::utf8_codecvt<wchar_t>());
  20. return boost::filesystem::path::imbue(tmp);
  21. }
  22. } // namespace nowide
  23. } // namespace boost
  24. #endif