aboutsummaryrefslogtreecommitdiff
path: root/butl/filesystem.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-06-22 23:18:56 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-06-23 15:13:12 +0300
commit748eab79085d7c8a3b3da90316a90a892db884ae (patch)
tree8bb0b2c1e7fba762530bd0e23320cc5a667ca249 /butl/filesystem.cxx
parentdbd6d3ea474a8fbc6b2a8cbfeec34dbbc58f0553 (diff)
Add ignore_error parameter to rmdir_r(), fix try_rmdir_r()
Diffstat (limited to 'butl/filesystem.cxx')
-rw-r--r--butl/filesystem.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/butl/filesystem.cxx b/butl/filesystem.cxx
index 72e1812..a2d6434 100644
--- a/butl/filesystem.cxx
+++ b/butl/filesystem.cxx
@@ -111,7 +111,7 @@ namespace butl
}
void
- rmdir_r (const dir_path& p, bool dir)
+ rmdir_r (const dir_path& p, bool dir, bool ignore_error)
{
// An nftw()-based implementation (for platforms that support it)
// might be a faster way.
@@ -121,16 +121,16 @@ namespace butl
path ep (p / de.path ()); //@@ Would be good to reuse the buffer.
if (de.ltype () == entry_type::directory)
- rmdir_r (path_cast<dir_path> (ep));
+ rmdir_r (path_cast<dir_path> (ep), true, ignore_error);
else
- try_rmfile (ep);
+ try_rmfile (ep, ignore_error);
}
if (dir)
{
rmdir_status r (try_rmdir (p));
- if (r != rmdir_status::success)
+ if (r != rmdir_status::success && !ignore_error)
throw system_error (r == rmdir_status::not_empty ? ENOTEMPTY : ENOENT,
system_category ());
}