From 4e2024e2e6b8309f2db6548e04e920f565a84b0b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 18 Mar 2021 15:47:49 +0200 Subject: Add try_rmfile_ignore_error() --- libbutl/filesystem.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libbutl/filesystem.cxx') 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 + 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; -- cgit v1.1