aboutsummaryrefslogtreecommitdiff
path: root/libbutl/filesystem.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-03-18 15:47:49 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-03-18 15:47:49 +0200
commit4e2024e2e6b8309f2db6548e04e920f565a84b0b (patch)
tree001e925df9c90af89a34e12fc373f05ce60682a6 /libbutl/filesystem.cxx
parent5956bce9b873b8cd481cb40cddef1bda882f5a3f (diff)
Add try_rmfile_ignore_error()
Diffstat (limited to 'libbutl/filesystem.cxx')
-rw-r--r--libbutl/filesystem.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/libbutl/filesystem.cxx b/libbutl/filesystem.cxx
index 18be8a9..2147c6f 100644
--- a/libbutl/filesystem.cxx
+++ b/libbutl/filesystem.cxx
@@ -1063,8 +1063,8 @@ namespace butl
}
}
- rmfile_status
- try_rmfile (const path& p, bool ignore_error)
+ optional<rmfile_status>
+ try_rmfile_maybe_ignore_error (const path& p, bool ignore_error)
{
rmfile_status r (rmfile_status::success);
const char* f (p.string ().c_str ());
@@ -1143,6 +1143,8 @@ namespace butl
r = rmfile_status::not_exist;
else if (!ignore_error)
throw_generic_error (errno);
+ else
+ return nullopt;
}
return r;