From: Enrico Forestieri Date: Fri, 13 Mar 2015 17:12:08 +0000 (+0100) Subject: Make sure that a generated temporary filename doesn't end with a dot. X-Git-Tag: 2.2.0alpha1~1197 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=ee6583ff94497c290898444da5ce3853b89e937d;p=features.git Make sure that a generated temporary filename doesn't end with a dot. This may happen if the extension is empty, and a filename ending with a dot may give troubles on Windows. --- diff --git a/src/graphics/GraphicsCacheItem.cpp b/src/graphics/GraphicsCacheItem.cpp index 9fab10dbf9..2e8c415f36 100644 --- a/src/graphics/GraphicsCacheItem.cpp +++ b/src/graphics/GraphicsCacheItem.cpp @@ -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()) {