filesystem.hpp 935 B

1234567891011121314151617181920212223242526272829
  1. //
  2. // Copyright (c) 2012 Artyom Beilis (Tonkikh)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See
  5. // accompanying file LICENSE_1_0.txt 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. #if(defined(__GNUC__) && __GNUC__ < 5)
  11. #pragma GCC diagnostic ignored "-Wunused-parameter"
  12. #endif
  13. #include <boost/nowide/utf8_codecvt.hpp>
  14. #include <boost/filesystem/path.hpp>
  15. namespace boost {
  16. namespace nowide {
  17. ///
  18. /// Install utf8_codecvt facet into boost::filesystem::path such all char strings are interpreted as utf-8 strings
  19. ///
  20. inline std::locale nowide_filesystem()
  21. {
  22. std::locale tmp = std::locale(std::locale(), new boost::nowide::utf8_codecvt<wchar_t>());
  23. return boost::filesystem::path::imbue(tmp);
  24. }
  25. } // namespace nowide
  26. } // namespace boost
  27. #endif