Vitaly Lipatov wrote:
> I guess we have to convert filenames of any graphics in 7 bit
> clean form like this path does. It resolves problems with
> russian names of files with graphics inserted in LyX.
> 
> --- /home/lav/RPM/BUILD/lyx-1.3.3/src/insets/insetgraphics.C
> 2003-09-30 23:55:18 +0400
> +++ src/insets/insetgraphics.C        2003-10-27 01:52:16 +0300
> @@ -629,6 +629,7 @@
>  subst(temp_file, ".", "_"), ext_tmp);
>  // now we have any_dir_file.ext
>  temp_file = MakeAbsPath(temp_file, buf->tmppath);
> +             temp_file = MakeLatexName(temp_file);
>  lyxerr[Debug::GRAPHICS]
>  << "\tchanged to: " << temp_file << endl;

Many thanks for this, Vitaly, and apologies for taking so long to reply.

I wonder if this patch would not be clearer in its intent (and so more likely 
to be preserved when well meaning ignorants (such as myself) try and clean up 
the code.)

Could you try it out and confirm that it works correctly?

Regards,
Angus
Index: src/insets/insetgraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.146.2.2
diff -u -p -r1.146.2.2 insetgraphics.C
--- src/insets/insetgraphics.C	15 Sep 2003 10:11:27 -0000	1.146.2.2
+++ src/insets/insetgraphics.C	15 Dec 2003 09:32:58 -0000
@@ -746,16 +746,21 @@ int InsetGraphics::latex(Buffer const *b
 	// "nice" means that the buffer is exported to LaTeX format but not
 	//        run through the LaTeX compiler.
 	if (buf->niceFile) {
-		os << before <<'{' << params().filename << '}' << after;
+		os << before <<'{' << MakeLatexName(params().filename)
+		   << '}' << after;
 		return 1;
 	}
 
 	// Make the filename relative to the lyx file
 	// and remove the extension so the LaTeX will use whatever is
 	// appropriate (when there are several versions in different formats)
+	string const latex_name =  message.empty() ?
+		MakeLatexName(os::external_path(prepareFile(buf))) :
+		MakeLatexName(params().filename);
+
 	string const latex_str = message.empty() ?
-		(before + '{' + os::external_path(prepareFile(buf)) + '}' + after) :
-		(before + '{' + params().filename + " not found!}" + after);
+		(before + '{' + latex_name + '}' + after) :
+		(before + '{' + latex_name + " not found!}" + after);
 	os << latex_str;
 
 	// Return how many newlines we issued.

Reply via email to