FileObject.delete() calls FileObject.delete(Selectors.SELECT_SELF)
So all the juice is in delete(FileSelector)

There we find section

>>> SNIP
// If the file is a folder, make sure all its children have been deleted
if (file.type == FileType.FOLDER && file.getChildren().length != 0)
{
    // TODO - fail??
    // Skip
    continue;
}
<<< SNAP

So the call to file.getChildren().length != 0 is already made during delete
for every folder.

Then a call to provider is made only after ensuring that folder does not have
any children.

The best way would be to move the children check to deleteSelf() method where
the check for IMAGINARY is done.

Then delete(FileSelector) could return the amount of files it deleted.
And then delete() could return whatever it gets from delete(FileSelector).
If it is 1 file was deleted otherwise it would be 0.

-- Rami

>I will have a look at it, but i think i will implement it that way.

>>Since I don't know the imlementations of the providers (yet) I can't
>>say what would be the most efficient strategy but one idea could
>>be that delete would return boolean that would tell whether something
>>was deleted or not.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to