mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-04 11:13:58 +08:00
refs #151, stop throwing on fs:🇩🇪:refresh for broken symlinks, and added test
This commit is contained in:
parent
a7a6d930fb
commit
6a94e84da4
@ -5273,7 +5273,7 @@ GHC_INLINE void directory_entry::refresh()
|
||||
{
|
||||
std::error_code ec;
|
||||
refresh(ec);
|
||||
if (ec) {
|
||||
if (ec && (_status.type() == file_type::none || _symlink_status.type() != file_type::symlink)) {
|
||||
throw filesystem_error(detail::systemErrorText(ec.value()), _path, ec);
|
||||
}
|
||||
}
|
||||
|
@ -1386,6 +1386,16 @@ TEST_CASE("fs.dir.entry - class directory_entry", "[filesystem][directory_entry]
|
||||
CHECK(!(d2 != d2));
|
||||
CHECK(d1 == d1);
|
||||
CHECK(!(d1 == d2));
|
||||
if(is_symlink_creation_supported()) {
|
||||
fs::create_symlink(t.path() / "nonexistent", t.path() / "broken");
|
||||
for (auto d3 : fs::directory_iterator(t.path())) {
|
||||
CHECK_NOTHROW(d3.symlink_status());
|
||||
CHECK_NOTHROW(d3.status());
|
||||
CHECK_NOTHROW(d3.refresh());
|
||||
}
|
||||
fs::directory_entry entry(t.path() / "broken");
|
||||
CHECK_NOTHROW(entry.refresh());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("fs.class.directory_iterator - class directory_iterator", "[filesystem][directory_iterator][fs.class.directory_iterator]")
|
||||
|
Loading…
x
Reference in New Issue
Block a user