X-Git-Url: https://git.decadent.org.uk/gitweb/?p=videolink.git;a=blobdiff_plain;f=temp_file.cpp;h=fc4106c27bc658e3377afae4caf9ea8ebcdb0e75;hp=6b8165c1541ec97bd6b635fbde9886c31abd406c;hb=c5f98ff303d670f72a5d491a5f4e1989d2043219;hpb=fed762f0b70eeb556c4b1bd660beb129099e8068 diff --git a/temp_file.cpp b/temp_file.cpp index 6b8165c..fc4106c 100644 --- a/temp_file.cpp +++ b/temp_file.cpp @@ -1,4 +1,4 @@ -// Copyright 2005 Ben Hutchings . +// Copyright 2005 Ben Hutchings . // See the file "COPYING" for licence details. #include "temp_file.hpp" @@ -37,9 +37,12 @@ temp_file::~temp_file() { close(); - // Don't assert that this is successful. The file could have - // been removed by another process. - unlink(name_.c_str()); + if (!keep_) + { + // Don't assert that this is successful. The file could have + // been removed by another process. + unlink(name_.c_str()); + } } void temp_file::close() @@ -51,3 +54,10 @@ void temp_file::close() fd_ = -1; } } + +bool temp_file::keep_ = false; + +void temp_file::keep_all(bool keep) +{ + keep_ = keep; +}