diff options
Diffstat (limited to 'libcutl/fs/auto-remove.cxx')
-rw-r--r-- | libcutl/fs/auto-remove.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libcutl/fs/auto-remove.cxx b/libcutl/fs/auto-remove.cxx new file mode 100644 index 0000000..9aad242 --- /dev/null +++ b/libcutl/fs/auto-remove.cxx @@ -0,0 +1,30 @@ +// file : libcutl/fs/auto-remove.cxx +// license : MIT; see accompanying LICENSE file + +#include <cstdio> // std::remove +#include <cerrno> + +#include <libcutl/fs/auto-remove.hxx> + +namespace cutl +{ + namespace fs + { + auto_remove:: + ~auto_remove () + { + if (!canceled_) + std::remove (path_.string ().c_str ()); // Ignore error. + } + + auto_removes:: + ~auto_removes () + { + if (!canceled_) + { + for (paths::iterator i (paths_.begin ()); i != paths_.end (); ++i) + std::remove (i->string ().c_str ()); // Ignore error. + } + } + } +} |