Andreas Vox wrote:

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

I did not look at that. Shall I? ;-))

> 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 thought it was a check wether the directory can be created. I would have
forgotten the case where a file (but no directory) with the same name
already exists. Maybe you should not use the shortcut so that it is clear
to readers what is meant.

>> 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?

That would be the better option IMHO.

> 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..

It should only be called once for every path. addExternalDirectory checks
wether the to-be-added directory is already in the list and does not add it
a second time if yes. At least I think it does this, I did not try, but
IMHO it should behave like that.

> If I separate files and directories, I could put directories
> into a set and handle them before any file. Sounds ok?

Yes.


Georg

Reply via email to