@@ -2227,6 +2227,13 @@ GHC_INLINE file_status status_ex(const path& p, std::error_code& ec, file_status
2227
2227
if (result == 0 ) {
2228
2228
fs = detail::file_status_from_st_mode (st.st_mode );
2229
2229
}
2230
+ else {
2231
+ ec = detail::make_system_error ();
2232
+ if (detail::is_not_found_error (ec)) {
2233
+ return file_status (file_type::not_found, perms::unknown);
2234
+ }
2235
+ return file_status (file_type::none);
2236
+ }
2230
2237
}
2231
2238
if (sz) {
2232
2239
*sz = static_cast <uintmax_t >(st.st_size );
@@ -4661,23 +4668,22 @@ GHC_INLINE uintmax_t remove_all(const path& p, std::error_code& ec) noexcept
4661
4668
auto fs = status (p, tec);
4662
4669
if (exists (fs) && is_directory (fs)) {
4663
4670
for (auto iter = directory_iterator (p, ec); iter != directory_iterator (); iter.increment (ec)) {
4664
- if (ec) {
4671
+ if (ec && ! detail::is_not_found_error (ec) ) {
4665
4672
break ;
4666
4673
}
4667
4674
bool is_symlink_result = iter->is_symlink (ec);
4668
4675
if (ec)
4669
4676
return static_cast <uintmax_t >(-1 );
4670
- bool is_directory_result = iter->is_directory (ec);
4671
- if (ec)
4672
- return static_cast <uintmax_t >(-1 );
4673
- if (!is_symlink_result && is_directory_result) {
4677
+ if (!is_symlink_result && iter->is_directory (ec)) {
4674
4678
count += remove_all (iter->path (), ec);
4675
4679
if (ec) {
4676
4680
return static_cast <uintmax_t >(-1 );
4677
4681
}
4678
4682
}
4679
4683
else {
4680
- remove (iter->path (), ec);
4684
+ if (!ec) {
4685
+ remove (iter->path (), ec);
4686
+ }
4681
4687
if (ec) {
4682
4688
return static_cast <uintmax_t >(-1 );
4683
4689
}
0 commit comments