Skip to content

Commit

Permalink
additions to changes for #6, don't count removal of non-existing files
Browse files Browse the repository at this point in the history
  • Loading branch information
gulrak committed Mar 6, 2019
1 parent b98a74a commit 036cf96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions test/filesystem_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 036cf96

Please sign in to comment.