Add TempFile::remove()
This commit is contained in:
parent
fcd239ac65
commit
525c29c65d
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user