Changes:
- Fix for #91, the way the CMake build options
GHC_FILESYSTEM_BUILD_TESTING
,GHC_FILESYSTEM_BUILD_EXAMPLES
andGHC_FILESYSTEM_WITH_INSTALL
where 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::path
was originally created from the POSIX based implementation was, by adaption of the incoming and outgoing strings. This resulted in a mutable cache insidefs::path
on Windows, that was inherently not thread-safe, even forconst
methods.
To not add additional patches to a suboptimal solution, this time I reworked thepath
code to now store native path-representation. This changed a lot of code, but when combined withwchar_t
asvalue_type
helped 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 benoexcept
as the standard mandates- On Windows
wchar_t
is now the default forfs::path::value_type
andstd::wstring
is the default fürfs::path::string_type
. - This allows the implementation to call Win-API without allocating conversions
- Thread-safety on
const
methods offs::path
is 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::string
based approach for Windows is still needed, it can be activated withGHC_WIN_DISABLE_WSTRING_STORAGE_TYPE
- Enhancement for #89,
fs::file_status
now supportsoperator==
introduced instd::filesystem
with 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.