additions to changes for #6, don't count removal of non-existing files

This commit is contained in:
Steffen Schuemann 2019-03-06 07:05:10 +01:00
parent b98a74ab1d
commit 036cf96bb6
2 changed files with 5 additions and 2 deletions

View File

@ -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)

View File

@ -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());
}