You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Prateek Asthana <hk...@gmail.com> on 2008/05/11 03:30:26 UTC

FileSet behavior

Hi,
This is to understand fileset attribute behavior. Definition of
FileSet is that it is a group of files.

My observation about Fileset is that depending upon the context it
behaves differently. I have given two scenarios below. Please help me
understand correctly.

First scenario:

   <path id="temp1">
       <fileset dir="${module.testautomap.basedir}">
       </fileset>
   </path>

    Above case, temp1 only contains files even though base directory
has empty directories. So I assume, fileset only returns files and not
empty directory.


Second Scnarios:
<copy todir="${testautomap.output.dir}">
           <fileset dir="${module.testautomap.basedir}/src">
           </fileset>
       </copy>

In the second scenario, even empty directories are copied implying
fileset even returns empty directories.

In fact we also have a selector <type type="file"> that can be used
with fileset. So I am confused as to what all does fileset return.
Does it return only files or also directories? If both, why does my
first scenario only print files and not directories.

Thanks,
Prateek

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: FileSet behavior

Posted by Andrew Goktepe <an...@gmail.com>.
Prateek,

The behavior you are seeing is probably more indicative of how <path>
handles the output of <fileset>, rather than <fileset> returning different
things in different contexts.  While I don't know for sure, my guess is that
<fileset> is always returning the directories but its caller might be doing
other things to filter them out.

-Andrew

On Sat, May 10, 2008 at 8:30 PM, Prateek Asthana <hk...@gmail.com>
wrote:

> Hi,
> This is to understand fileset attribute behavior. Definition of
> FileSet is that it is a group of files.
>
> My observation about Fileset is that depending upon the context it
> behaves differently. I have given two scenarios below. Please help me
> understand correctly.
>
> First scenario:
>
>   <path id="temp1">
>       <fileset dir="${module.testautomap.basedir}">
>       </fileset>
>   </path>
>
>    Above case, temp1 only contains files even though base directory
> has empty directories. So I assume, fileset only returns files and not
> empty directory.
>
>
> Second Scnarios:
> <copy todir="${testautomap.output.dir}">
>           <fileset dir="${module.testautomap.basedir}/src">
>           </fileset>
>       </copy>
>
> In the second scenario, even empty directories are copied implying
> fileset even returns empty directories.
>
> In fact we also have a selector <type type="file"> that can be used
> with fileset. So I am confused as to what all does fileset return.
> Does it return only files or also directories? If both, why does my
> first scenario only print files and not directories.
>
> Thanks,
> Prateek
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>