]> git.lyx.org Git - features.git/commitdiff
Always require a mask to get a temporary filename
authorVincent van Ravesteijn <vfr@lyx.org>
Thu, 3 May 2012 09:55:54 +0000 (11:55 +0200)
committerVincent van Ravesteijn <vfr@lyx.org>
Sun, 6 May 2012 15:23:20 +0000 (17:23 +0200)
If no mask is supplied or the mask is attached to the end of the filename, we end up with unexpected names like
  <system-temp-dir>\lyx_tmpdir.qHp780.vcr780_<mask>
instead of a temporary file in the lyx temporary directory like
  <system-temp-dir>\lyx_tmpdir.qHp780\<mask>.vcr780.

(cherry picked from commit 5e4e4b674c00bc546213d42258f19e13a2b28bc3)

src/CutAndPaste.cpp
src/LayoutFile.cpp
src/frontends/qt4/GuiWorkArea.cpp
src/support/FileName.h
status.20x

index c767c93be73356fcdff1f1bd2a17dff52a511040..d31af1b8d9f77b1b9c019c1b51f2e791b4aa11f4 100644 (file)
@@ -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);
index 541f2dae84290c8f69c305a0c713fc53e66b4f85..39e07554f9fe95e357f8520a1f86826a31b4e85d 100644 (file)
@@ -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.
index 859f76e3af2c97dc5c9faf3875b9df3f91ccc912..ac454947331b3539d647ef90d1bed70bc4879fe2 100644 (file)
@@ -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_);
index 23e6fd0d408a9e6625b7ac7589676ba119951657..66c2175a3b385fd649c6913382d797b3911120d7 100644 (file)
@@ -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);
 
index 93ffb8ffef47ebcd6425523dd46b339eea636d4d..7810fd0f7ff54808ef7ecbd142300b256fe1feb4 100644 (file)
@@ -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