On 07/07/2009, rgheck <rgh...@bobjweil.com> wrote:
> Sergiu Carpov wrote:
>> Your solution doesn't work, because "expfile" has save_abs_path_ true
>> and in "params.filename" this fields is false. For the comparison of
>> DocFileName this value must be the same.
>>
>>
> Hmm, OK, I see the issue.
>
>> By the way, what does it means "save_abs_path_" field?
>>
>>
> It seems to record whether the filename provided was absolute or not.
> This tells us whether we should reference the file via an absolute or
> relative path (e.g., when producing LaTeX, or saving the LyX file).
>
>> And also a minor difference is that in my example it was not-equal sign.
>>
>>
> Right!
>
>> I propose the next patch:
>>
>>
> Unfortunately, this one can't be guaranteed to work, either, since
> save_abs_path_ could be true. So it looks as if maybe your original
> patch was best, though I'd still rather do such comparisons in a central
> locale.
>
> Anyway, the original patch was this:
>
> 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);
>                         }
>                 }
>         }
>
>
> JMarc, do you have any thoughts about this? As I said earlier, I'd rather
> do the comparison a different way, but....
>
>
> Richard
>
>

Taking into account that "file" is relative to the master document, I
propose the next patch:

Index: src/insets/ExternalSupport.cpp
===================================================================
--- src/insets/ExternalSupport.cpp      (revision 30398)
+++ 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 (makeAbsPath(file, masterBuffer->filePath()) 
!=
params.filename.absFilename())
+                                       exportdata.addExternalFile(rit->first, 
source, file);
                        }
                }
        }


In this way we are comparing absolute file names. I've tested it and all is ok.

-- 
Sergiu Carpov

Reply via email to