diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-03-18 15:47:49 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-03-18 15:47:49 +0200 |
commit | 4e2024e2e6b8309f2db6548e04e920f565a84b0b (patch) | |
tree | 001e925df9c90af89a34e12fc373f05ce60682a6 /libbutl/filesystem.ixx | |
parent | 5956bce9b873b8cd481cb40cddef1bda882f5a3f (diff) |
Add try_rmfile_ignore_error()
Diffstat (limited to 'libbutl/filesystem.ixx')
-rw-r--r-- | libbutl/filesystem.ixx | 17 |
1 files changed, 17 insertions, 0 deletions
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<rmfile_status> + 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<rmfile_status> + try_rmfile_ignore_error (const path& p) + { + return try_rmfile_maybe_ignore_error (p, true); + } + + inline path followsymlink (const path& p) { |