filesystem icon indicating copy to clipboard operation
filesystem copied to clipboard

More Code convertion support

Open thegoodtgg opened this issue 2 years ago • 1 comments

I am using ghc::filesystem on windows 10. I just can't construct ghc::filesystem::path with std::string in GBK encoding that is my encoding in locale. Because ghc::filesystem::path assumes std::string all in utf-8 encoding. Can you support codecvt in ghc::fileysystem::path constructor.

template <class Source, typename> inline path::path(const Source& source, format fmt) #ifdef GHC_USE_WCHAR_T : _path(detail::toWChar(source)) #else : _path(detail::toUtf8(source)) #endif { postprocess_path_with_format(fmt); }

template <typename strT, typename std::enable_if<path::_is_basic_string<strT>::value && (sizeof(typename strT::value_type) == 1), bool>::type = false> inline std::wstring toWChar(const strT& unicodeString) { return fromUtf8<std::wstring>(unicodeString); }

Maybe add another constructor

template<typename Source, typename CodeCvt> path(const Source &source, const CodeCvt &codeCvt, format format)

And I am considering using boost::filesystem instead.

thegoodtgg avatar Jul 27 '22 07:07 thegoodtgg

I'm sorry, ghc::filesystem really is Unicode-centric utf8-everywhere motivated and documented as such. I don't have the resources to test for all the non-Unicode setups out there, as it is a single-dev project in my free time, and making changes I can't test to work is problematic for me.

gulrak avatar Aug 30 '22 13:08 gulrak

Thank you for your reply. I admire your wonderful work and your choice is right. I am using boost::filesystem instead. Please close the issue.

thegoodtgg avatar Nov 09 '22 01:11 thegoodtgg