From 525c29c65dee8623e99081d91892529734357551 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sat, 22 Dec 2018 00:54:04 +0100 Subject: [PATCH] Add TempFile::remove() --- src/cpp-utils/tempfile/TempFile.cpp | 6 +++++- src/cpp-utils/tempfile/TempFile.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cpp-utils/tempfile/TempFile.cpp b/src/cpp-utils/tempfile/TempFile.cpp index 716e2b2d..7c4a254c 100644 --- a/src/cpp-utils/tempfile/TempFile.cpp +++ b/src/cpp-utils/tempfile/TempFile.cpp @@ -25,13 +25,17 @@ TempFile::TempFile(bool create) TempFile::~TempFile() { try { if (exists()) { - bf::remove(_path); + remove(); } } catch (const boost::filesystem::filesystem_error &e) { LOG(ERR, "Could not delete tempfile."); } } +void TempFile::remove() { + bf::remove(_path); +} + bool TempFile::exists() const { return bf::exists(_path); } diff --git a/src/cpp-utils/tempfile/TempFile.h b/src/cpp-utils/tempfile/TempFile.h index bf7641a1..80e15317 100644 --- a/src/cpp-utils/tempfile/TempFile.h +++ b/src/cpp-utils/tempfile/TempFile.h @@ -15,6 +15,8 @@ public: const boost::filesystem::path &path() const; //TODO Test exists() bool exists() const; + //TODO Test remove() + void remove(); private: const boost::filesystem::path _path;