diff --git a/doc/release_history.html b/doc/release_history.html
index a75a27b..d5e04c3 100644
--- a/doc/release_history.html
+++ b/doc/release_history.html
@@ -40,10 +40,12 @@
1.64.0
+ is_empty()overload with error_code parameter
+ should not throw on error. Thanks to ldqrk for pull request #42
- Fix #10731 and
#9480, Evaluate
path.extension only once. Thanks to Daniel Krügler for pull request #41.
- - Fix errno propagation in
space(p, ec). Thanks to cmuellner
+ - Fix error propagation in
space(p, ec). Thanks to cmuellner
for pull request #39.
- Add test/config_info.cpp to increase macro state reporting in hopes of
easing debugging on remote machines.
diff --git a/src/operations.cpp b/src/operations.cpp
index 37ec1b8..78ee02f 100644
--- a/src/operations.cpp
+++ b/src/operations.cpp
@@ -329,9 +329,10 @@ namespace
// general helpers -----------------------------------------------------------------//
- bool is_empty_directory(const path& p)
+ bool is_empty_directory(const path& p, error_code* ec)
{
- return fs::directory_iterator(p)== end_dir_itr;
+ return (ec != 0 ? fs::directory_iterator(p, *ec) : fs::directory_iterator(p))
+ == end_dir_itr;
}
bool not_found_error(int errval); // forward declaration
@@ -1408,7 +1409,7 @@ namespace detail
p, ec, "boost::filesystem::is_empty"))
return false;
return S_ISDIR(path_stat.st_mode)
- ? is_empty_directory(p)
+ ? is_empty_directory(p, ec)
: path_stat.st_size == 0;
# else
@@ -1420,7 +1421,7 @@ namespace detail
if (ec != 0) ec->clear();
return
(fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- ? is_empty_directory(p)
+ ? is_empty_directory(p, ec)
: (!fad.nFileSizeHigh && !fad.nFileSizeLow);
# endif
}