From 748eab79085d7c8a3b3da90316a90a892db884ae Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 22 Jun 2016 23:18:56 +0300 Subject: Add ignore_error parameter to rmdir_r(), fix try_rmdir_r() --- butl/filesystem.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'butl/filesystem.cxx') 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 (ep)); + rmdir_r (path_cast (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 ()); } -- cgit v1.1