diff --git a/include/nana/filesystem/filesystem.hpp b/include/nana/filesystem/filesystem.hpp index 782ecfea..4cea3916 100644 --- a/include/nana/filesystem/filesystem.hpp +++ b/include/nana/filesystem/filesystem.hpp @@ -162,6 +162,10 @@ namespace filesystem const value_type*c_str() const; const string_type& native() const; operator string_type() const; + + std::string string() const; + std::wstring wstring() const; + std::string u8string() const; private: void _m_assign(const std::string& source_utf8); void _m_assign(const std::wstring& source); diff --git a/source/filesystem/filesystem.cpp b/source/filesystem/filesystem.cpp index d0e9b320..af9f11ea 100644 --- a/source/filesystem/filesystem.cpp +++ b/source/filesystem/filesystem.cpp @@ -173,6 +173,21 @@ namespace nana { namespace experimental { return native(); } + std::string path::string() const + { + return to_osmbstr(to_utf8(pathstr_)); + } + + std::wstring path::wstring() const + { + return to_wstring(pathstr_); + } + + std::string path::u8string() const + { + return to_utf8(pathstr_); + } + void path::_m_assign(const std::string& source_utf8) { #if defined(NANA_WINDOWS) diff --git a/source/paint/detail/image_bmp.hpp b/source/paint/detail/image_bmp.hpp index 6ff94496..a4737720 100644 --- a/source/paint/detail/image_bmp.hpp +++ b/source/paint/detail/image_bmp.hpp @@ -84,7 +84,7 @@ namespace nana{ namespace paint bool open(const nana::experimental::filesystem::path& filename) override { - std::ifstream ifs(filename.c_str(), std::ios::binary); + std::ifstream ifs(filename.string(), std::ios::binary); if(ifs) { ifs.seekg(0, std::ios::end); diff --git a/source/paint/image.cpp b/source/paint/image.cpp index 53fc1c34..06204ef6 100644 --- a/source/paint/image.cpp +++ b/source/paint/image.cpp @@ -263,7 +263,7 @@ namespace paint //Check for BMP if (!helper) { - std::ifstream ifs(file.c_str(), std::ios::binary); + std::ifstream ifs(file.string(), std::ios::binary); if (ifs) { unsigned short meta = 0;