please test with this patch all graphic-files in the doc-dir are untouched, except the user has use_tempdir=false.
there is still only one strange situation. for example - no tempdir and file my.gif with an existing my.eps - there is no other way than to overwrite this existing eps file while converting from gif to eps without using a tempdir. The only way is to warn the user, but than we have tons of warnings when using a lot of graphic files. on the other hand the user can work with no tempdir and LyX creates all eps-files and let them undeleted in the doc-dir Herbert -- http://www.lyx.org/help/
Index: src/insets/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v retrieving revision 1.400 diff -u -r1.400 ChangeLog --- src/insets/ChangeLog 19 Apr 2002 17:16:00 -0000 1.400 +++ src/insets/ChangeLog 20 Apr 2002 06:16:50 -0000 @@ -1,3 +1,8 @@ +2002-04-20 Herbert Voss <[EMAIL PROTECTED]> + + * insetgraphic.C (prepareFile): fix bug with overwriting and + deleting an existing *.eps-file in the doc-dir + 2002-04-19 Herbert Voss <[EMAIL PROTECTED]> * insetgraphic.C (prepareFile): return filename without Index: src/insets/insetgraphics.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v retrieving revision 1.105 diff -u -r1.105 insetgraphics.C --- src/insets/insetgraphics.C 19 Apr 2002 17:16:00 -0000 1.105 +++ src/insets/insetgraphics.C 20 Apr 2002 06:16:51 -0000 @@ -94,6 +94,7 @@ #include "LaTeXFeatures.h" #include "frontends/Dialogs.h" +#include "frontends/Alert.h" #include "frontends/controllers/helper_funcs.h" // getVectorFromString #include "support/LAssert.h" @@ -632,6 +633,8 @@ string const from = getExtFromContents(filename_); string const to = findTargetFormat(from); + lyxerr[Debug::GRAPHICS] << "\tfrom:" << from << endl; + lyxerr[Debug::GRAPHICS] << "\tto :" << to << endl; if (from == to) { // No conversion needed! @@ -640,14 +643,28 @@ string const temp = MakeAbsPath(filename_, buf->tmppath); string const outfile_base = RemoveExtension(temp); + // first we copy the original file from the docdir into + // the temp dir but only when use-tmpdir is enabled + if (!IsFileReadable(temp) && lyxrc.use_tempdir) { + bool success = lyx::copy(filename_, temp); + lyxerr[Debug::GRAPHICS] << "[prepareFile] copy from " + << filename_ << " to " << temp << "\n"; + if (!success) { + Alert::alert(_("cannot copy file"), filename_, + _("into tempdir")); + return filename_; + } + } - lyxerr[Debug::GRAPHICS] << "tempname = " << temp << "\n"; - lyxerr[Debug::GRAPHICS] << "buf::tmppath = " << buf->tmppath << "\n"; - lyxerr[Debug::GRAPHICS] << "filename_ = " << filename_ << "\n"; - lyxerr[Debug::GRAPHICS] << "outfile_base = " << outfile_base << endl; - - converters.convert(buf, filename_, outfile_base, from, to); - return RemoveExtension(filename_); + lyxerr[Debug::GRAPHICS] << "calling convert with these values:" << endl; + lyxerr[Debug::GRAPHICS] << "\ttempname = " << temp << endl; + lyxerr[Debug::GRAPHICS] << "\tbuf->tmppath = " << buf->tmppath << endl; + lyxerr[Debug::GRAPHICS] << "\toutfile_base = " << outfile_base << endl; + lyxerr[Debug::GRAPHICS] << "\t(filename_ = " << filename_ << ")\n"; + + converters.convert(buf, temp, outfile_base, from, to); + // from now we only work with the tempfile + return RemoveExtension(temp); }