diff --git a/tempfile/TempFile.cpp b/tempfile/TempFile.cpp index bea2d5aa..5307fc1d 100644 --- a/tempfile/TempFile.cpp +++ b/tempfile/TempFile.cpp @@ -19,11 +19,15 @@ TempFile::TempFile(bool create) } TempFile::~TempFile() { - if (bf::exists(_path)) { + if (exists()) { bf::remove(_path); } } +bool TempFile::exists() const { + return bf::exists(_path); +} + const bf::path &TempFile::path() const { return _path; } diff --git a/tempfile/TempFile.h b/tempfile/TempFile.h index 7d5fc956..e4b4b448 100644 --- a/tempfile/TempFile.h +++ b/tempfile/TempFile.h @@ -13,6 +13,7 @@ public: explicit TempFile(bool create = true); virtual ~TempFile(); const boost::filesystem::path &path() const; + bool exists() const; private: const boost::filesystem::path _path;