aboutsummaryrefslogtreecommitdiff
path: root/butl/filesystem.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-29 13:04:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-29 13:04:29 +0200
commitefd154a6af61e80be1b0c46642cefd73cc83d7ed (patch)
treef41400d27727800d7f72317f80ee8e43285792b4 /butl/filesystem.cxx
parentcdc67ad0cf1e102568396b0649dd18ea1223d785 (diff)
Add auto_rmfile and auto_rmdir
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 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 ());
}