aboutsummaryrefslogtreecommitdiff
path: root/bpkg/utility.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-16 16:11:00 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-16 16:11:00 +0200
commit829c0083b1684e7513e0bd1bb0a92f767ba83f77 (patch)
tree7ea2de1908d74cbc6656e6e53d2190d9eafde7e2 /bpkg/utility.cxx
parent422afdb14a7a0c141bce59287377bca1b1b34a07 (diff)
Add rm(path) function
Diffstat (limited to 'bpkg/utility.cxx')
-rw-r--r--bpkg/utility.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx
index 632791c..d9e0413 100644
--- a/bpkg/utility.cxx
+++ b/bpkg/utility.cxx
@@ -93,6 +93,23 @@ namespace bpkg
}
void
+ rm (const path& f)
+ {
+ if (verb >= 3)
+ text << "rm " << f;
+
+ try
+ {
+ if (try_rmfile (f) == rmfile_status::not_exist)
+ fail << "unable to remove file " << f << ": file does not exist";
+ }
+ catch (const system_error& e)
+ {
+ fail << "unable to remove file " << f << ": " << e.what ();
+ }
+ }
+
+ void
rm_r (const dir_path& d, bool dir)
{
if (verb >= 3)