diff --git a/filesystem.h b/filesystem.h index e387442..6cd936c 100644 --- a/filesystem.h +++ b/filesystem.h @@ -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(-1); } - return ++count; + return count; } inline void rename(const path& from, const path& to) diff --git a/test/filesystem_test.cpp b/test/filesystem_test.cpp index 11d5276..04ffce0 100644 --- a/test/filesystem_test.cpp +++ b/test/filesystem_test.cpp @@ -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()); }