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

Today I released v1.5.0
of
ghc::filesystem
, my implementation of C++17
std::filesystem
for C++11, C++14, C++17 and C++20.
This release is the result of a major refactoring: on Windows fs::path now
stores the native path-representation with wchar_t as value_type,
removing a mutable cache that was inherently not thread-safe and avoiding
lots of conversions on calls to the Win-API.
The full list of changes 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.
I want to thank all contributors for their support!