The attached patch brings the handling of graphics file extensions in
sync with 1.2.2, so it should probably be applied.

However, recent discussions have shown that this handling of
extensions is not very good. In particular, we should probably keep
the extensions when not doing a nice file, and remove them when it
makes sense when doing a nice file. We should also make sure to know
what we want in the case of html, where we run latex before doing the
export.

The reason why extensions are now kept in latex export is bug #514.
I'd appreciate if somebody could take a look and think of a better
solution.

Lars, either we decide to do nothing for 1.3.0 and the patch should be
applied, or we should think about this issue, which is important IMO.

JMarc

Index: src/insets/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.421.2.26
diff -u -p -r1.421.2.26 ChangeLog
--- src/insets/ChangeLog	4 Dec 2002 14:51:16 -0000	1.421.2.26
+++ src/insets/ChangeLog	10 Dec 2002 17:26:02 -0000
@@ -1,3 +1,10 @@
+2002-12-10  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* insetgraphics.C (prepareFile): do not remove the extension of
+	the file name if it is not the default extension for the given
+	format (that is, in latex output, remove extension from foo.eps,
+	but not from foo.epsi)
+
 2002-11-20  Juergen Vigna  <[EMAIL PROTECTED]>
 
 	* insettabular.C (resetPos): temporary fix for endless loop in
Index: src/insets/insetgraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.109.2.5
diff -u -p -r1.109.2.5 insetgraphics.C
--- src/insets/insetgraphics.C	16 Jul 2002 22:11:17 -0000	1.109.2.5
+++ src/insets/insetgraphics.C	10 Dec 2002 17:26:02 -0000
@@ -708,12 +708,22 @@ string const InsetGraphics::prepareFile(
 	lyxerr[Debug::GRAPHICS]
 		<< "\t we have: from " << from << " to " << to << '\n';
 	if (from == to) {
-		// No conversion is needed. LaTeX can handle the graphic file as is.
-		// This is true even if the orig_file is compressed. We have to return
-		// the orig_file_with_path, maybe it is a zipped one
-		if (lyxrc.use_tempdir)
-			return RemoveExtension(temp_file);
-		return RemoveExtension(orig_file_with_path);
+		// No conversion is needed. LaTeX can handle the
+		// graphic file as is. This is true even if the
+		// orig_file is compressed. We have to return the
+		// orig_file_with_path, maybe it is a zipped one
+
+		// If the extension is not the default one (e.g. .epsi
+		// instead of .eps), then we do not remove it. (JMarc 20021210)
+		if (formats.getFormat(to)->extension() == GetExtension(orig_file)) {
+			if (lyxrc.use_tempdir)
+				return RemoveExtension(temp_file);
+			return RemoveExtension(orig_file_with_path);
+		} else {
+			if (lyxrc.use_tempdir)
+				return temp_file;
+			return orig_file_with_path;
+		}
 	}
 
 	string const outfile_base = RemoveExtension(temp_file);

Reply via email to