]> git.lyx.org Git - lyx.git/blobdiff - src/support/TempFile.cpp
Check return value of regex_match instead of looking at first match
[lyx.git] / src / support / TempFile.cpp
index 5c4b389b8499c146fdf50fce3d610c132746788c..6e5a91d6e67b281b71db96eb438736b39d783ec5 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"
 
@@ -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