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;