rgheck <rgh...@...> writes:

> 
> Sergiu Carpov wrote:
> > Hi,
> >
> > I am trying to fix this bug. And I have observed an incoherences in the
> > source code.
> > I'm examining the static function "updateExternal" from "external"
> > namespace, see this page
> >
http://wiki.lyx.org/sourcedoc/svn/namespacelyx_1_1external.html#940e34e099754314ff8a1ca2ac1b9b65
> > There it is used the class Template::Format, this class has "updateResult"
> > and "referencedFiles" fields. Which are both used in "updateExternal"
> > function. And now my question are:
> > 1. What are the differences between this two fields?
> >
> >   
> These are explained in section 6.2.2 of the Customization manual. They 
> hold the contents of the corresponding tags from the template 
> specification. Here's what it says:
> 
> ReferencedFile <format> <filename> This command denotes files that are 
> created by the conversion process and are needed for a particular export 
> format. If the filename is relative, it is interpreted relative to the 
> master document. This command may be given zero or more times.
> 
> So these files are generated by the conversion and need to be exported. 
> There may be more than one, or it may depend upon the precise export format.
> 
> UpdateResult <filename> The file name of the converted file. The file 
> name must be absolute. This command must occur exactly once.
> 
> This is the name to which we will do the conversion. It probably will 
> itself be exported, too. Have a look at the lib/external_templates file 
> to see how these are used.
> 
> > 2. Why in the "updateExternal" function, lines 272-302 we add to the
> > exported files all the "referencedFiles"? 
> >
> >   
> I think the above should answer this: They're needed, for whatever 
> reason, by the format for which they are defined.
> 
> > And in other lines, below and
> > above, we work (copy to the temp dir and perform conversion) only with
> > "updateResult" file? It seems to me that something is not right there, I
> > can't understant why we convert only one file ("updateResult" field) and
> > export several files ("referencedFiles").
> >
> >   
> The converter itself may produce extra files, or the one we need may 
> depend upon the format. See the XFig template, for example. But you will 
> note that they are normally the same.
> 
> Richard
> 
> 

I propose the following fix for this bug:

Index: src/insets/ExternalSupport.cpp
===================================================================
--- src/insets/ExternalSupport.cpp      (revision 30336)
+++ src/insets/ExternalSupport.cpp      (working copy)
@@ -296,7 +296,8 @@
                                                      ALL_BUT_PATHS);
                                // if file is a relative name, it is interpreted
                                // relative to the master document.
-                               exportdata.addExternalFile(rit->first, source, 
file);
+                               if (file != params.filename.absFilename())
+                                       exportdata.addExternalFile(rit->first, 
source, file);
                        }
                }
        }


I suppose that the included and exported files are the same if their absolute
paths are equal. In this case the included file should not be exported.

Reply via email to