You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@apache.org> on 2005/10/19 21:23:16 UTC
FileSet#iterator only returning files
Hi (Matt ;-),
the design decision to not return directories in FileSet affects the
tasks that want to read files and directories.
If I code a generic task that just uses iterator, I'll never see
directories from FileSet (or any of FileSet's subclasses), instead I
have to check whether I'm dealing with a fileset subclass.
Even worse, there is no way to get the included directories of
<union>
<fileset dir="A"/>
<fileset dir="B"/>
</union>
What shall we do? Return files and directories and let the user
explicitly use a <type> selector would be my preference.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: FileSet#iterator only returning files
Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 19 Oct 2005, Matt Benson <gu...@yahoo.com> wrote:
>> What shall we do? Return files and directories and let the user
>> explicitly use a <type> selector would be my preference.
>>
> I don't see that we have much choice given your
> example above. Wouldn't we have to invert the
> situation and explicitly ignore directories in tasks
> that have historically used only the results of
> ds.getIncludedFiles() ?
This or make the task check isDirectory() on the resources, yes.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: FileSet#iterator only returning files
Posted by Matt Benson <gu...@yahoo.com>.
--- Stefan Bodewig <bo...@apache.org> wrote:
> Hi (Matt ;-),
>
> the design decision to not return directories in
> FileSet affects the
> tasks that want to read files and directories.
>
> If I code a generic task that just uses iterator,
> I'll never see
> directories from FileSet (or any of FileSet's
> subclasses), instead I
> have to check whether I'm dealing with a fileset
> subclass.
That is what I had been doing, yes:
public void add(FileSet fs) {
add((ResourceCollection)
new /*oata.types.resources.*/BCFileSet(fs));
}
public void add(ResourceCollection rc) {
//whatever
}
>
> Even worse, there is no way to get the included
> directories of
>
> <union>
> <fileset dir="A"/>
> <fileset dir="B"/>
> </union>
Hmm... good point. :(
>
> What shall we do? Return files and directories and
> let the user
> explicitly use a <type> selector would be my
> preference.
>
I don't see that we have much choice given your
example above. Wouldn't we have to invert the
situation and explicitly ignore directories in tasks
that have historically used only the results of
ds.getIncludedFiles() ?
-Matt
> Stefan
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
>
>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org