>>>>> "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

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

The way it works is to remove extension only for .eps and .ps. Should
I consider other cases too? Now that I think about it, should I do
something about .pdf too? Please, experts, I need your input.

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	6 Dec 2002 14:58:03 -0000
@@ -1,3 +1,9 @@
+2002-12-06  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* insetgraphics.C (removePSExtension): renamed from
+	RemoveExtension; only removes extension if it is .eps or .ps, that
+	is extensions that latex tries anyway.
+
 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	6 Dec 2002 14:58:04 -0000
@@ -98,11 +98,12 @@ int const VersionNumber = 1;
 namespace {
 
 // This function is a utility function
-// ... that should be with ChangeExtension ...
-inline
-string const RemoveExtension(string const & filename)
+string const removePSExtension(string const & filename)
 {
-	return ChangeExtension(filename, string());
+	string const ext = GetExtension(filename);
+	if (ext == "eps" || ext == "ps")
+		return ChangeExtension(filename, string());
+	return filename;
 }
 
 
@@ -699,7 +700,7 @@ string const InsetGraphics::prepareFile(
 			if (!success) {
 				Alert::alert(_("Cannot copy file"), orig_file_with_path,
 					_("into tempdir"));
-				return RemoveExtension(orig_file);
+				return removePSExtension(orig_file);
 			}
 		}
 	}
@@ -712,11 +713,11 @@ string const InsetGraphics::prepareFile(
 		// 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);
+			return removePSExtension(temp_file);
+		return removePSExtension(orig_file_with_path);
 	}
 
-	string const outfile_base = RemoveExtension(temp_file);
+	string const outfile_base = removePSExtension(temp_file);
 	lyxerr[Debug::GRAPHICS]
 		<< "\tThe original file is " << orig_file << "\n"
 		<< "\tA copy has been made and convert is to be called with:\n"
@@ -725,7 +726,7 @@ string const InsetGraphics::prepareFile(
 		<< "\t from " << from << " to " << to << '\n';
 
 	converters.convert(buf, temp_file, outfile_base, from, to);
-	return RemoveExtension(temp_file);
+	return removePSExtension(temp_file);
 }
 
 
@@ -837,7 +838,7 @@ void InsetGraphics::validate(LaTeXFeatur
 	if (params().filename.empty())
 		return ;
 
-	features.includeFile(graphic_label, RemoveExtension(params().filename));
+	features.includeFile(graphic_label, removePSExtension(params().filename));
 
 	features.require("graphicx");
 

Reply via email to