Sheesh, something somewhere has gone wrong with InsetGraphic's generation of EPS files from bitmaps in order to generate PS output.
Attached is a kludgy solution and a test case that demonstrates the problem. Yet more reason to create a FileName class. This stuff is too fragile to be funny. Also InsetGraphic's latex generation routines suck donkeys. Herbert may know his latex, but I hate his code :-{ Perhaps some kind sole will investigate further and ascertain why there's a need to "add a unique id" to copyFileToDir else taulogo.png and q13_graph.fig both generate eps files in the buffer tmp dir with the same name. Something is going badly wrong I fear. Why do we bother to try and do this magic manipulation of the file name. Why not just generate a unique name and be done with it? A new function string const uniqueName(); seems in order, generating a different string on each call. Anyway, it's too late now. Good night. -- Angus
Index: src/insets/insetgraphics.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v retrieving revision 1.182 diff -u -p -r1.182 insetgraphics.C --- src/insets/insetgraphics.C 3 Jun 2003 17:49:09 -0000 1.182 +++ src/insets/insetgraphics.C 5 Jun 2003 23:48:19 -0000 @@ -330,8 +330,12 @@ string const InsetGraphics::prepareFile( string orig_file = params().filename; string const rel_file = MakeRelPath(orig_file, buf->filePath()); - if (!IsFileReadable(rel_file)) + if (!IsFileReadable(orig_file)) { + lyxerr[Debug::GRAPHICS] + << "InsetGraphics::prepareFile\n" + << "No file '" << orig_file << "' can be found!" << endl; return rel_file; + } bool const zipped = zippedFile(orig_file); @@ -521,6 +525,8 @@ int InsetGraphics::latex(Buffer const * (before + '{' + relative_file + " not found!}" + after); os << latex_str; + lyxerr[Debug::GRAPHICS] << "InsetGraphics::latex outputting:\n" + << latex_str << endl; // Return how many newlines we issued. return int(lyx::count(latex_str.begin(), latex_str.end(),'\n') + 1); } Index: src/support/filetools.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v retrieving revision 1.153 diff -u -p -r1.153 filetools.C --- src/support/filetools.C 3 Jun 2003 10:14:52 -0000 1.153 +++ src/support/filetools.C 5 Jun 2003 23:48:20 -0000 @@ -1337,6 +1337,9 @@ string copyFileToDir(string const & path file_out = subst(file_out, "/", "_"); // Replace '.' in the file name with '_' file_out = subst(file_out, ".", "_"); + // Append a unique ID + static int id; + file_out += '_' + tostr(id++); // Add the extension back on file_out = ChangeExtension(file_out, GetExtension(file_in)); // Put this file in the buffer's temp dir
test.tar.gz
Description: GNU Zip compressed data