aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2015-11-16 05:53:10 -0500
committerShea Levy <shea@shealevy.com>2015-11-16 05:53:10 -0500
commit58d2fac91d0da7312e3ef147b6b290ea16031da8 (patch)
treeba474622269f885954478d3713ab39da098a8821 /src/libutil/util.cc
parent4390142315a0d6ed0f67712061498c68389ea3b7 (diff)
AutoDelete: Add default constructor with deletion disabled
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 27116fd18..84f578eec 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -599,6 +599,8 @@ string drainFD(int fd)
//////////////////////////////////////////////////////////////////////
+AutoDelete::AutoDelete() : del{false} {}
+
AutoDelete::AutoDelete(const string & p, bool recursive) : path(p)
{
del = true;
@@ -626,6 +628,12 @@ void AutoDelete::cancel()
del = false;
}
+void AutoDelete::reset(const Path & p, bool recursive = true) {
+ this-> p = p;
+ this->recursive = recursive;
+ del = true;
+}
+
//////////////////////////////////////////////////////////////////////