ghc::filesystem Release v1.5.0
2021-02-07 14:10

Heute habe ich v1.5.0
von
ghc::filesystem
veröffentlicht, meiner
Implementation der C++17-Komponente std::filesystem
für C++11, C++14, C++17 und C++20.
Dieses Release ist das Ergebnis eines größeren Refactorings: Unter Windows
speichert fs::path nun die native Pfad-Repräsentation mit wchar_t als
value_type, wodurch ein interner Cache entfällt, der prinzipbedingt nicht
threadsicher war, und viele Konvertierungen bei Win-API-Aufrufen vermieden
werden.
Die Änderungen in v1.5.0:
- Fix for #91
, the way the CMake build options
GHC_FILESYSTEM_BUILD_TESTING,GHC_FILESYSTEM_BUILD_EXAMPLESandGHC_FILESYSTEM_WITH_INSTALLwhere implemented, prohibited setting them from a parent project when using this viaadd_subdirectory, this fix allows to set them again. - Major refactoring for #90
, the way, the Windows version of
fs::pathwas originally created from the POSIX based implementation was, by adaption of the incoming and outgoing strings. This resulted in a mutable cache insidefs::pathon Windows, that was inherently not thread-safe, even forconstmethods. To not add additional patches to a suboptimal solution, this time I reworked thepathcode to now store native path-representation. This changed a lot of code, but when combined withwchar_tasvalue_typehelped to avoid lots of conversion for calls to Win-API. As interfaces where changed, it had to be released in a new minor version. The set of refactorings resulted in the following changes:fs::path::native()andfs::path::c_str()can now benoexceptas the standard mandates- On Windows
wchar_tis now the default forfs::path::value_typeandstd::wstringis the default fürfs::path::string_type. - This allows the implementation to call Win-API without allocating conversions
- Thread-safety on
constmethods offs::pathis no longer an issue - Some code could be simplified during this refactoring
- Automatic prefixing of long path on Windows can now be disabled with defining
GHC_WIN_DISABLE_AUTO_PREFIXES, for all other types of prefixes or namespaces the behavior follows that of MSVCstd::filesystem::path - In case the old
char/std::stringbased approach for Windows is still needed, it can be activated withGHC_WIN_DISABLE_WSTRING_STORAGE_TYPE
- Enhancement for #89
,
fs::file_statusnow supportsoperator==introduced instd::filesystemwith C++20. - Refactoring for #88
,
fs::path::parent_path()had a performance issue, as it was still using a loop based approach to recreate the parent from elements. This created lots of temporaries and was too slow especially on long paths.
Ich danke allen Beteiligten für ihre Unterstützung!