From 58946a2996c875e65f558463ca41a918f7249909 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Thu, 3 May 2012 11:55:54 +0200 Subject: [PATCH] Always require a mask to get a temporary filename If no mask is supplied or the mask is attached to the end of the filename, we end up with unexpected names like \lyx_tmpdir.qHp780.vcr780_ instead of a temporary file in the lyx temporary directory like \lyx_tmpdir.qHp780\.vcr780. (cherry picked from commit 5e4e4b674c00bc546213d42258f19e13a2b28bc3) --- src/CutAndPaste.cpp | 2 +- src/LayoutFile.cpp | 2 +- src/frontends/qt4/GuiWorkArea.cpp | 2 +- src/support/FileName.h | 2 +- status.20x | 3 +++ 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index c767c93be7..d31af1b8d9 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -470,7 +470,7 @@ void putClipboard(ParagraphList const & paragraphs, // some kind of garbage collection there, or a shared_ptr, then this // would not be needed. static Buffer * buffer = theBufferList().newBuffer( - FileName::tempName().absFileName() + "_clipboard.internal"); + FileName::tempName("clipboard.internal").absFileName()); buffer->setUnnamed(true); buffer->paragraphs() = paragraphs; buffer->inset().setBuffer(*buffer); diff --git a/src/LayoutFile.cpp b/src/LayoutFile.cpp index 541f2dae84..39e07554f9 100644 --- a/src/LayoutFile.cpp +++ b/src/LayoutFile.cpp @@ -212,7 +212,7 @@ string layoutpost = LayoutFileIndex LayoutFileList::addEmptyClass(string const & textclass) { - FileName const tempLayout = FileName::tempName(); + FileName const tempLayout = FileName::tempName("basic_layout"); ofstream ofs(tempLayout.toFilesystemEncoding().c_str()); // This writes a very basic class, but it also attempts to include // stdclass.inc. That would give us something moderately usable. diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 859f76e3af..ac45494733 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -1370,7 +1370,7 @@ bool GuiWorkArea::isFullScreen() EmbeddedWorkArea::EmbeddedWorkArea(QWidget * w): GuiWorkArea(w) { buffer_ = theBufferList().newBuffer( - support::FileName::tempName().absFileName() + "_embedded.internal"); + support::FileName::tempName("embedded.internal").absFileName()); buffer_->setUnnamed(true); buffer_->setFullyLoaded(true); setBuffer(*buffer_); diff --git a/src/support/FileName.h b/src/support/FileName.h index 23e6fd0d40..66c2175a3b 100644 --- a/src/support/FileName.h +++ b/src/support/FileName.h @@ -183,7 +183,7 @@ public: /// \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()'. - static FileName tempName(std::string const & mask = empty_string()); + static FileName tempName(std::string const & mask); static FileName tempName(FileName const & temp_dir, std::string const & mask); diff --git a/status.20x b/status.20x index 93ffb8ffef..7810fd0f7f 100644 --- a/status.20x +++ b/status.20x @@ -91,6 +91,9 @@ What's new - When configuring LyX, check for all LaTeX-packages LyX uses to display symbols (bug 8102). +- Fix the naming of some temporary files such that they are created + in LyX's temporary directory. + * USER INTERFACE -- 2.39.5