filesystem.hpp 840 B

12345678910111213141516171819202122232425262728
  1. //
  2. // Copyright (c) 2012 Artyom Beilis (Tonkikh)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // https://www.boost.org/LICENSE_1_0.txt
  6. #ifndef BOOST_NOWIDE_INTEGRATION_FILESYSTEM_HPP_INCLUDED
  7. #define BOOST_NOWIDE_INTEGRATION_FILESYSTEM_HPP_INCLUDED
  8. #include <boost/nowide/utf8_codecvt.hpp>
  9. #include <boost/filesystem/path.hpp>
  10. namespace boost {
  11. namespace nowide {
  12. ///
  13. /// Install utf8_codecvt facet into boost::filesystem::path
  14. /// such that all char strings are interpreted as UTF-8 strings
  15. /// \return The previous imbued path locale.
  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