Closed ilyapopov closed 1 year ago
I decided to fix the exception for broken symlinks as that is driven by external factors, but keep the behavior for initializing a directory_entry
with an empty or non existing file as that is more often a usage error I keep wanting to assert. The specs are not clear to me there, and I try to not change behavior not explicitly defined as it is surprising for users of ghc::fs
, but I think this change is for the better and more consistent.
Describe the bug In presence of a broken symlink,
directory_entry::refresh()
throws, while bothstatus()
andsymlink_status()
succeed. Under the same circumstances,libstdc++
succeeds.To Reproduce
Clang with libc++ behaves the same as GCC.
Expected behavior
I expect
refresh()
succeed and savefile_status(file_type::not_found)
into directory_entry instead.Additional context
OS: Ubuntu 22.04 gcc: gcc version 11.2.0 (Ubuntu 11.2.0-19ubuntu1) ghc_filesystem: cd6805e94dd5d6346be1b75a54cdc27787319dd2 clang++: Ubuntu clang version 14.0.0-1ubuntu1
https://en.cppreference.com/w/cpp/filesystem/status https://en.cppreference.com/w/cpp/filesystem/directory_entry/refresh