From efd154a6af61e80be1b0c46642cefd73cc83d7ed Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 29 Sep 2015 13:04:29 +0200 Subject: Add auto_rmfile and auto_rmdir --- 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 f1341ee..5a43cd2 100644 --- a/butl/filesystem.cxx +++ b/butl/filesystem.cxx @@ -81,7 +81,7 @@ namespace butl } rmdir_status - try_rmdir (const dir_path& p) + try_rmdir (const dir_path& p, bool ignore_error) { rmdir_status r (rmdir_status::success); @@ -91,7 +91,7 @@ namespace butl r = rmdir_status::not_exist; else if (errno == ENOTEMPTY || errno == EEXIST) r = rmdir_status::not_empty; - else + else if (!ignore_error) throw system_error (errno, system_category ()); } @@ -125,7 +125,7 @@ namespace butl } rmfile_status - try_rmfile (const path& p) + try_rmfile (const path& p, bool ignore_error) { rmfile_status r (rmfile_status::success); @@ -133,7 +133,7 @@ namespace butl { if (errno == ENOENT || errno == ENOTDIR) r = rmfile_status::not_exist; - else + else if (!ignore_error) throw system_error (errno, system_category ()); } -- cgit v1.1