]> git.lyx.org Git - features.git/commitdiff
fix quoted graphics file names
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Mon, 20 Jun 2005 14:11:11 +0000 (14:11 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Mon, 20 Jun 2005 14:11:11 +0000 (14:11 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10093 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetgraphics.C

index 995b46095a3937a5d021317e24f7349a2f7006c5..7bde2258ffdda09836d62236d8bd4a23a58488b5 100644 (file)
@@ -1,3 +1,9 @@
+2005-06-20  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
+
+       * insetgraphics.C (prepareFile): don't strip the extension of quoted
+       filenames
+       * insetgraphics.C (stripExtensionIfPossible): fix lyxdot replacement
+
 2005-06-16  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * insettabular.C (getStatus): disable LFUN_TABULAR_INSERT
index 72139e5bab3b7e6b57aa8c7731c00c5941d08673..3b6e2b41462bac87a5071c47ae99bd4f41762829 100644 (file)
@@ -518,7 +518,7 @@ copyToDirIfNeeded(string const & file_in, string const & dir, bool zipped)
 }
 
 
-string const stripExtension(string const & file)
+string const stripExtensionIfPossible(string const & file)
 {
        // Remove the extension so the LaTeX will use whatever
        // is appropriate (when there are several versions in
@@ -526,7 +526,12 @@ string const stripExtension(string const & file)
        // This works only if the filename contains no dots besides
        // the just removed one. We can fool here by replacing all
        // dots with a macro whose definition is just a dot ;-)
-       return subst(RemoveExtension(file), ".", "\\lyxdot ");
+       // The automatic format selection does not work if the file
+       // name is escaped.
+       string const latex_name = latex_path(file);
+       if (latex_name[0] == '"')
+               return latex_name;
+       return subst(latex_path(RemoveExtension(file)), ".", "\\lyxdot ");
 }
 
 
@@ -540,8 +545,8 @@ string const stripExtensionIfPossible(string const & file, string const & to)
        if (to_format == file_format ||
            (to_format == "eps" && file_format ==  "ps") ||
            (to_format ==  "ps" && file_format == "eps"))
-               return stripExtension(file);
-       return file;
+               return stripExtensionIfPossible(file);
+       return latex_path(file);
 }
 
 } // namespace anon
@@ -628,7 +633,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
                                        source_file, output_file);
                        // We can't strip the extension, because we don't know
                        // the unzipped file format
-                       return output_file;
+                       return latex_path(output_file);
                }
 
                string const unzipped_temp_file = unzippedFileName(temp_file);
@@ -688,7 +693,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
                                                      output_to_file);
                runparams.exportdata->addExternalFile("dvi", to_file,
                                                      output_to_file);
-               return stripExtension(output_file);
+               return stripExtensionIfPossible(output_file);
        }
 
        lyxerr[Debug::GRAPHICS]
@@ -704,7 +709,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
                                to_file, output_to_file);
        }
 
-       return stripExtension(output_file);
+       return stripExtensionIfPossible(output_file);
 }
 
 
@@ -760,7 +765,7 @@ int InsetGraphics::latex(Buffer const & buf, ostream & os,
        // Convert the file if necessary.
        // Remove the extension so LaTeX will use whatever is appropriate
        // (when there are several versions in different formats)
-       latex_str += latex_path(prepareFile(buf, runparams));
+       latex_str += prepareFile(buf, runparams);
        latex_str += '}' + after;
        os << latex_str;