mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-04 11:13:58 +08:00
additions to changes for #6, don't count removal of non-existing files
This commit is contained in:
parent
b98a74ab1d
commit
036cf96bb6
@ -3712,12 +3712,14 @@ inline uintmax_t remove_all(const path& p, std::error_code& ec) noexcept
|
||||
}
|
||||
}
|
||||
if(!ec) {
|
||||
remove(p, ec);
|
||||
if(remove(p, ec)) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
if (ec) {
|
||||
return static_cast<uintmax_t>(-1);
|
||||
}
|
||||
return ++count;
|
||||
return count;
|
||||
}
|
||||
|
||||
inline void rename(const path& from, const path& to)
|
||||
|
@ -2028,6 +2028,7 @@ TEST_CASE("30.10.15.31 remove_all", "[filesystem][operations][fs.op.remove_all]"
|
||||
generateFile("dir1/dir1b/f2");
|
||||
CHECK_NOTHROW(fs::remove_all("dir1/non-existing", ec));
|
||||
CHECK(!ec);
|
||||
CHECK(fs::remove_all("dir1/non-existing", ec) == 0);
|
||||
CHECK(fs::remove_all("dir1") == 5);
|
||||
CHECK(fs::directory_iterator(t.path()) == fs::directory_iterator());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user