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.ixx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'libbutl/filesystem.ixx') diff --git a/libbutl/filesystem.ixx b/libbutl/filesystem.ixx index f7c3777..8cd8456 100644 --- a/libbutl/filesystem.ixx +++ b/libbutl/filesystem.ixx @@ -38,6 +38,23 @@ namespace butl return e ? rmdir_status::success : rmdir_status::not_exist; } + LIBBUTL_SYMEXPORT optional + try_rmfile_maybe_ignore_error (const path&, bool ignore_error); + + inline rmfile_status + try_rmfile (const path& p, bool ignore_error) + { + auto r (try_rmfile_maybe_ignore_error (p, ignore_error)); + return r ? *r : rmfile_status::success; + } + + inline optional + try_rmfile_ignore_error (const path& p) + { + return try_rmfile_maybe_ignore_error (p, true); + } + + inline path followsymlink (const path& p) { -- cgit v1.1