X-Git-Url: https://git.decadent.org.uk/gitweb/?p=videolink.git;a=blobdiff_plain;f=temp_file.cpp;h=6dd6c555fcd62fd4725ac64a57c5498ce77eaa94;hp=6b8165c1541ec97bd6b635fbde9886c31abd406c;hb=392b6372714c8c2b2bf2389b86fb8f47ef70c2ef;hpb=54639f8de60d5ea53bf49383294d403f526e25ca 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; +}