]> git.lyx.org Git - features.git/commitdiff
Make sure that a generated temporary filename doesn't end with a dot.
authorEnrico Forestieri <forenr@lyx.org>
Fri, 13 Mar 2015 17:12:08 +0000 (18:12 +0100)
committerEnrico Forestieri <forenr@lyx.org>
Fri, 13 Mar 2015 17:12:08 +0000 (18:12 +0100)
This may happen if the extension is empty, and a filename ending with
a dot may give troubles on Windows.

src/graphics/GraphicsCacheItem.cpp

index 9fab10dbf9c4549363efcf780c10a87234b61f82..2e8c415f36b6709d849389281d2a084f6e031a64 100644 (file)
@@ -364,9 +364,10 @@ bool CacheItem::Impl::tryDisplayFormat(FileName & filename, string & from)
        if (zipped_) {
                string tempname = unzippedFileName(filename_.toFilesystemEncoding());
                string const ext = getExtension(tempname);
+               tempname = changeExtension(tempname, "") + "-XXXXXX";
                if (!ext.empty())
-                       tempname = changeExtension(tempname, "");
-               TempFile tempfile(tempname + "-XXXXXX." + ext);
+                       tempname = addExtension(tempname, ext);
+               TempFile tempfile(tempname);
                tempfile.setAutoRemove(false);
                unzipped_filename_ = tempfile.name();
                if (unzipped_filename_.empty()) {