Lars Gullik Bj�nnes wrote:

 > Herbert Voss <[EMAIL PROTECTED]> writes:
 >
 > | Herbert Voss wrote:
 >
 >>> > It appears the conversion routine is only converting the first 
file. I
 >>> > presume it sees that the file name is the same as a converted file
 >>> > already
 >>> > in the tmp dir, so it doesn't bother to go through again.
 >>>could you please try this patch with your doc, it should
 >>>fix the problem.
 >>>
 >>
 > | It runs for me with same file in different dirs,
 >
 > Did you test with different files with same name? In same dir and in
 > different dirs?


the same file in four different dirs and two of them twice
in the doc and one zipped with and one without extra bb-file.
run with and without use_tempdir

voss@maria:/tmp/lyx_tmpdir121488KKRCR/lyx_tmpbuf0> ls -l
total 68
-rw-r--r-- 1 voss users  9288 May 10 16:07 _home_voss_LyX_atEnd.eps
-rw-r--r-- 1 voss users  9288 May 10 16:05
_home_voss_lyx-devel.Info_atEnd.eps
-rw-r--r-- 1 voss users  9288 May 10 16:05 _tmp_atEnd.eps
-rw-r--r-- 1 voss users  2629 May 10 19:51 _tmp_atEnd.eps.gz
-rw-r--r-- 1 voss users  9288 May 10 16:05 atEnd.eps

this patch fixes also the bug with reading
options from old files -> I love undocumented features ...
and anotherone with use_tempdir=false.

the changes are not very important, but this is a sensible
part of the graphics inset, so it would be nice if someelse
could test this patch, too.

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.415
diff -u -r1.415 ChangeLog
--- src/insets/ChangeLog        9 May 2002 13:43:40 -0000       1.415
+++ src/insets/ChangeLog        10 May 2002 17:43:34 -0000
@@ -1,3 +1,10 @@
+2002-05-10  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * insetgraphics.C (prepareFile): allow files with same name
+       in different dirs
+       (readFigInset): set the flags from old figinset in the right
+       manner
+
 2002-05-09  Juergen Vigna  <[EMAIL PROTECTED]>
 
        * insetcollapsable.C (edit): first_after_edit should only be
Index: src/insets/insetgraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.108
diff -u -r1.108 insetgraphics.C
--- src/insets/insetgraphics.C  3 May 2002 11:56:49 -0000       1.108
+++ src/insets/insetgraphics.C  10 May 2002 17:43:34 -0000
@@ -496,6 +496,8 @@
                                    break;
                                case 3: params_.display = InsetGraphicsParams::COLOR;
                                    break;
+                               case 8: params_.display = InsetGraphicsParams::NONE;
+                                   break;
                                }
                } else if (token == "subfigure") {
                        params_.subcaption = true;
@@ -602,14 +604,18 @@
        string const orig_file = params().filename;
        string const orig_file_with_path =
                MakeAbsPath(orig_file, buf->filePath());
+       lyxerr[Debug::GRAPHICS] << "prepareFile: " << orig_file
+               << "\n  with path: " << orig_file_with_path << endl;
 
        if (!IsFileReadable(orig_file_with_path))
                return orig_file;
 
        // If the file is compressed and we have specified that it should not be
        // uncompressed, then just return its name and let LaTeX do the rest!
-       bool const zipped = zippedFile(orig_file);
+       bool const zipped = zippedFile(orig_file_with_path);
        if (zipped && params().noUnzip) {
+               lyxerr[Debug::GRAPHICS] << "it's a zipped file\n"
+                       << "\twe pass it unzipped to LaTeX\n";
                return orig_file;
        }
 
@@ -627,9 +633,14 @@
 
        // Perform all these manipulations on a temporary file if possible.
        // If we are not using a temp dir, then temp_file contains the
-       // original file.
-       string temp_file = MakeAbsPath(OnlyFilename(orig_file), buf->tmppath);
-
+       // original file. 
+       // to allow files with the same name in different dirs
+       // we manipulate the orig_file "anydir/file" to "anydir_file"
+       string temp_file(orig_file);
+       if (lyxrc.use_tempdir) {
+               temp_file = subst(orig_file, "/", "_");
+               temp_file = MakeAbsPath(temp_file, buf->tmppath);
+       }
        lyxerr[Debug::GRAPHICS]
                << "InsetGraphics::prepareFile. The temp file is: "
                << temp_file << endl;
@@ -673,7 +684,11 @@
        }
 
        // Ascertain the graphics format that LaTeX requires.
-       string const from = getExtFromContents(temp_file);
+       // Make again an absolute path, maybe that we have no
+       // tempdir. Than temp_file=orig_file
+       string const from = lyxrc.use_tempdir ?
+               getExtFromContents(temp_file) :
+               getExtFromContents(MakeAbsPath(temp_file, buf->filePath()));
        string const to   = findTargetFormat(from);
 
        // No conversion is needed. LaTeX can handle the graphics file as it is.

Reply via email to