]> git.lyx.org Git - lyx.git/blobdiff - src/support/TempFile.cpp
Correct comment
[lyx.git] / src / support / TempFile.cpp
index 5c4b389b8499c146fdf50fce3d610c132746788c..e8ee5586b481cd71ffe567d06561aa7cb34d3917 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "support/debug.h"
 #include "support/FileName.h"
+#include "support/filetools.h"
 #include "support/Package.h"
 #include "support/qstring_helpers.h"
 
@@ -29,7 +30,7 @@ namespace support {
 struct TempFile::Private
 {
        ///
-       Private(QString const & mask) : f(mask)
+       explicit Private(QString const & mask) : f(mask)
        {
                LYXERR(Debug::FILES, "Temporary file in " << fromqstr(mask));
                if (f.open())
@@ -47,14 +48,16 @@ struct TempFile::Private
 
 TempFile::TempFile(FileName const & temp_dir, string const & mask)
 {
-       QFileInfo tmp_fi(QDir(toqstr(temp_dir.absoluteFilePath())), toqstr(mask));
+       QFileInfo tmp_fi(QDir(toqstr(temp_dir.absoluteFilePath())),
+                        toqstr(onlyFileName(mask)));
        d = new Private(tmp_fi.absoluteFilePath());
 }
 
 
 TempFile::TempFile(string const & mask)
 {
-       QFileInfo tmp_fi(QDir(toqstr(package().temp_dir().absoluteFilePath())), toqstr(mask));
+       QFileInfo tmp_fi(QDir(toqstr(package().temp_dir().absoluteFilePath())),
+                        toqstr(onlyFileName(mask)));
        d = new Private(tmp_fi.absoluteFilePath());
 }
 
@@ -74,5 +77,10 @@ FileName TempFile::name() const
 }
 
 
+void TempFile::setAutoRemove(bool autoremove)
+{
+       d->f.setAutoRemove(autoremove);
+}
+
 } // namespace support
 } // namespace lyx