This is the second attempt at the extension problem. I decided to never 
strip the extension in prepareFile(), since it is in 1.3 only called for 
creating temporary .tex files. For temporary .tex files we call latex 
directly and know which format is used, so there is no need to strip the 
extension. This would only make sense for "nice" files (and is done in 
1.4, but not in 1.3).
"nice" files are broken in 1.3 anyway (they have the original extension), 
so I don't think it is worth it to fix that.

Th e patch works for me. OK to commit?


Georg
diff -p -r -U 3 -X excl.tmp lyx-1.3-clean/src/insets/ChangeLog 
lyx-1.3-cvs/src/insets/ChangeLog
--- lyx-1.3-clean/src/insets/ChangeLog  2005-06-11 13:13:48.000000000 +0200
+++ lyx-1.3-cvs/src/insets/ChangeLog    2005-06-18 18:20:54.000000000 +0200
@@ -1,3 +1,8 @@
+2005-06-18  Georg Baum  <[EMAIL PROTECTED]>
+
+       * insetgraphics.C (prepareFile): Don't strip the extension, because
+       the substitution does not work when the file names are quoted
+
 2005-04-17  Angus Leeming  <[EMAIL PROTECTED]>
 
        * insetbib.C (latex):
diff -p -r -U 3 -X excl.tmp lyx-1.3-clean/src/insets/insetgraphics.C 
lyx-1.3-cvs/src/insets/insetgraphics.C
--- lyx-1.3-clean/src/insets/insetgraphics.C    2005-06-11 13:13:52.000000000 
+0200
+++ lyx-1.3-cvs/src/insets/insetgraphics.C      2005-06-18 18:37:29.000000000 
+0200
@@ -527,9 +527,18 @@ string const InsetGraphics::prepareFile(
 {
        // LaTeX can cope if the graphics file doesn't exist, so just
        // return the filename.
-       string const orig_file = params().filename;
+       string orig_file = params().filename;
        string orig_file_with_path =
                MakeAbsPath(orig_file, buf->filePath());
+       if (!IsFileReadable(orig_file_with_path)) {
+               if (IsFileReadable(orig_file_with_path + ".eps")) {
+                       orig_file += ".eps";
+                       orig_file_with_path += ".eps";
+               } else if (IsFileReadable(orig_file_with_path + ".ps")) {
+                       orig_file += ".ps";
+                       orig_file_with_path += ".ps";
+               }
+       }
        lyxerr[Debug::GRAPHICS] << "[InsetGraphics::prepareFile] orig_file = "
                    << orig_file << "\n\twith path: "
                    << orig_file_with_path << endl;
@@ -592,11 +601,7 @@ string const InsetGraphics::prepareFile(
                // No conversion is needed. LaTeX can handle the
                // graphic file as is.
                // This is true even if the orig_file is compressed.
-               if (formats.getFormat(to)->extension() == 
GetExtension(orig_file)) {
-                       return RemoveExtension(orig_file_with_path);
-               } else {
-                       return orig_file_with_path;
-               }
+               return orig_file_with_path;
        }
 
        // We're going to be running the exported buffer through the LaTeX
@@ -650,10 +655,7 @@ string const InsetGraphics::prepareFile(
                if (from == to) {
                        // No conversion is needed. LaTeX can handle the
                        // graphic file as is.
-                       if (formats.getFormat(to)->extension() == 
GetExtension(orig_file))
-                               return RemoveExtension(temp_file);
-                       else
-                               return temp_file;
+                       return temp_file;
                }
        }
 
@@ -691,7 +693,7 @@ string const InsetGraphics::prepareFile(
 #endif
        }
 
-       return RemoveExtension(temp_file);
+       return ChangeExtension(temp_file, formats.getFormat(to)->extension());
 }
 
 

Reply via email to