]> git.decadent.org.uk Git - videolink.git/blobdiff - temp_file.cpp
Added debugging option to keep temporary files.
[videolink.git] / temp_file.cpp
index 6b8165c1541ec97bd6b635fbde9886c31abd406c..6dd6c555fcd62fd4725ac64a57c5498ce77eaa94 100644 (file)
@@ -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;
+}