X-Git-Url: https://git.decadent.org.uk/gitweb/?p=videolink.git;a=blobdiff_plain;f=temp_file.cpp;h=6dd6c555fcd62fd4725ac64a57c5498ce77eaa94;hp=6b8165c1541ec97bd6b635fbde9886c31abd406c;hb=2f3abf1d90ae5f83d6d48a0c5e451397e48a4be0;hpb=fed762f0b70eeb556c4b1bd660beb129099e8068 diff --git a/temp_file.cpp b/temp_file.cpp index 6b8165c..6dd6c55 100644 --- a/temp_file.cpp +++ b/temp_file.cpp @@ -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; +}