]> git.lyx.org Git - features.git/commitdiff
Restore custom tmp directory
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 17 Feb 2020 08:00:08 +0000 (09:00 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:52 +0000 (15:48 +0200)
Fixes #1174

src/support/filetools.cpp
src/support/filetools.h

index a36446dc4cf880c2386e98cf37dfe218cac0f688..a34ee225f9a1dea000c8e692bfc4d2e98d851787 100644 (file)
@@ -442,9 +442,20 @@ string const commandPrep(string const & command_in)
 }
 
 
+FileName const tempFileName(FileName tempdir, string const & mask, bool const dir)
+{
+       return tempFileName(TempFile(tempdir, mask).name(), dir);
+}
+
+
 FileName const tempFileName(string const & mask, bool const dir)
 {
-       FileName tempfile = TempFile(mask).name();
+       return tempFileName(TempFile(mask).name(), dir);
+}
+
+
+FileName const tempFileName(FileName tempfile, bool const dir)
+{
        // Since the QTemporaryFile object is destroyed at function return
        // (which is what is intended here), the next call to this function
        // may return the same file name again.
@@ -499,7 +510,8 @@ static FileName createTmpDir(FileName const & tempdir, string const & mask)
 
        QFileInfo tmp_fi(QDir(toqstr(tempdir.absFileName())), toqstr(mask));
        FileName const tmpfl =
-               tempFileName(fromqstr(tmp_fi.absoluteFilePath()) + ".XXXXXXXXXXXX", true);
+               tempFileName(FileName(fromqstr(tmp_fi.absolutePath())),
+                            fromqstr(tmp_fi.fileName()) + ".XXXXXXXXXXXX", true);
 
        if (tmpfl.empty() || !tmpfl.createDirectory(0700)) {
                LYXERR0("LyX could not create temporary directory in " << tempdir
index 05b3d705ec740f66b5de6150a3c51828f07e0138..1ac0edf15b45cf40a93f53bc5c27ca0d4467e5a9 100644 (file)
@@ -40,6 +40,10 @@ static std::set<std::string> tmp_names_;
 * all used temp file names.
 * If you don't have to remove the temp file manually, use TempFile instead!
 */
+FileName const tempFileName(FileName, bool const dir = false);
+/// Get temporary file name with custom path
+FileName const tempFileName(FileName, std::string const &, bool const dir = false);
+/// Get temporary file name with default path
 FileName const tempFileName(std::string const &, bool const dir = false);
 
 /// Remove and unregister a temporary file.