Kornel Benko wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> 
> On Monday, 22. April 2002 17:46, Herbert Voss wrote:
> 
>>what happens when you try the patch
>>
>>http://www.mail-archive.com/lyx-devel%40lists.lyx.org/msg36886.html
>>
> 
> The same behaviour in this case.


ok, try this one.
now every tempdir has it's own graphic files

Herbert



-- 
http://www.lyx.org/help/
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  22 Apr 2002 21:09:10 -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,22 +633,39 @@
 
        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!
                return filename_;
        }
 
-       string const temp = MakeAbsPath(filename_, buf->tmppath);
+       string const temp = MakeAbsPath(OnlyFilename(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(filename_) && 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_;
+               }
+       } else 
+               lyxerr[Debug::GRAPHICS] << "[prepareFile] file " << temp 
+                       << " isn't readable" << endl;
+
+       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";
 
-       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_);
+       converters.convert(buf, temp, outfile_base, from, to);
+       return RemoveExtension(temp);
 }
 
 

Reply via email to