]> git.lyx.org Git - features.git/commitdiff
Make sure a temporary file is always created in the global temporary dir.
authorEnrico Forestieri <forenr@lyx.org>
Thu, 12 Mar 2015 23:31:08 +0000 (00:31 +0100)
committerEnrico Forestieri <forenr@lyx.org>
Thu, 12 Mar 2015 23:31:08 +0000 (00:31 +0100)
src/support/TempFile.cpp
src/support/TempFile.h

index 21559e144fe5418d245701dc6520468098ccdd49..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());
 }
 
index b99ee756a16c9d67541a2c2b4ab16399e6a025f9..53e91f0ae56a81632eb5c053db52d04167555be3 100644 (file)
@@ -33,9 +33,9 @@ class TempFile {
 public:
        /**
         *Create a temporary file with the given mask.
-        * \p mask must be in filesystem encoding, if it contains a
-        * relative path, the template file will be created in the global
-        * temporary directory as given by 'package().temp_dir()'.
+        * \p mask must be in filesystem encoding, the template file
+        * will be created in the global temporary directory as given
+        * by 'package().temp_dir()'.
         * If the mask contains "XXXXXX" this portion will be replaced by
         * a uniquely generated string. If it does not contain this portion,
         * it will be automatically appended using a dot. Therefore, please