>>>>> "Jean-Marc" == Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

>>>>> "Rod" == Rod Pinna <[EMAIL PROTECTED]> writes:
Rod> Futher to that last bit... The image in lyx is called as
Rod> something.epsi, but the error I get is

Rod> could not locate the file with any of these extensions: .eps,
Rod> .ps, .eps.gz, .ps.gz, eps.Z

Rod> The file is in the tmp dir named as something.epsi

Jean-Marc> Here is a patch that should fix this problem. I'd
Jean-Marc> appreciate if people could try it and comment on it. If it
Jean-Marc> works, I promise I'll release 1.2.2!

Of course the patch was wrong. Here is a completely different one (the
previous one did not work for things like jpg). I will probably commit
it tomorrow, but I'd appreciate feedback and criticism on how it
should be done.

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