Georg Baum <[EMAIL PROTECTED]> writes:

> 
> The patch looks good.

Thanks! :-)

> I think I found one little error and I have also some nitpicks 

I'm still waiting for the comments on whitespace ;-)

>  But in 
> general I would vote for inclusion.

Great.

> +   if (it->isDirectory) {
> +    if (! IsDirWriteable(path) && ! createDirectory(path,0777)) {
> 
> I think this should either be ||, not &&:
> 
> +    if (! IsDirWriteable(path) || ! createDirectory(path,0777)) {
> 
> or you could completely omit the check for IsDirWriteable(path).

No. I use IsDirWriteable() as a shortcut for exists(path) && isDirectory(path).
If the directory already exists it gets reused.
So the above check means:
Check if I can use the path as a directory and if that fails, 
try to create a new directory.


>  I would 
> prefer that, because this check should be either there for files and 
> directories or not at all and createDirectory will fail if the path is 
> not writeable.

But then I can't see the case where the directory already exists.
I tested it as it is and it works nicely: If I export to the same path again,
LyX asks for the main file and for all files in xyz_math/ if they should
be overwritten. Once you click "Yes to all", all files are overwritten silently.

> + /** add a referenced directory for one format.
> +  * \param format     format that references the given file
> +  * \param exportName resulting file name. Can be either absolute
> +  *                   or relative to the exported document.
> +  */
> 
> Please adjust the comment, this is no file 

Ok.

> 
> Your code relies on the fact that addExternalDirectory is called before a 
> call to addExternalFile with a file in that directory. You should 
> document that also.

Yes, definitely. Or maybe I should change the code so it doesn't matter?
I just noticed that "isDirWriteable || createDirectory" is called many times
for the same path. That's bad because if I recall correctly, isDirWriteable()
checks this the hard way.. 
If I separate files and directories, I could put directories
into a set and handle them before any file. Sounds ok?

Ciao
/Andreas


Reply via email to