Added TempFile::exists()

This commit is contained in:
Sebastian Messmer 2015-10-23 12:15:51 +02:00
parent ca5edb48db
commit 74cb9eaf2d
2 changed files with 6 additions and 1 deletions

View File

@ -19,11 +19,15 @@ TempFile::TempFile(bool create)
} }
TempFile::~TempFile() { TempFile::~TempFile() {
if (bf::exists(_path)) { if (exists()) {
bf::remove(_path); bf::remove(_path);
} }
} }
bool TempFile::exists() const {
return bf::exists(_path);
}
const bf::path &TempFile::path() const { const bf::path &TempFile::path() const {
return _path; return _path;
} }

View File

@ -13,6 +13,7 @@ public:
explicit TempFile(bool create = true); explicit TempFile(bool create = true);
virtual ~TempFile(); virtual ~TempFile();
const boost::filesystem::path &path() const; const boost::filesystem::path &path() const;
bool exists() const;
private: private:
const boost::filesystem::path _path; const boost::filesystem::path _path;