Well, here's how you can get a flattened list of file names:
I leaned this on a wild goose chase to do something that turned out to be
much simpler than I originally thought. However, I guess I still learned
something. Here it is:
<fileset dir="${src.dir}" id="sample.fs.src">
<present targetdir="${src.dir}">
<mapper type="glob" from="sample.*" to="*" />
</present>
</fileset>
<pathconvert pathsep="," property="sample.fs.src.copies"
setonempty="false" refid="sample.fs.src">
<map from="${src.dir}${file.separator}sample." to=""/>
</pathconvert>
<fileset dir="${src.dir}" includes="${sample.fs.src.copies}" />
That grabs all files that exist in the src.dir with the naming scheme
"sample.*" that have a corresponding "*" file in the same directory. Then
I use <pathconvert> to iterate through the files returned with a <map>
element to remove all the path info all the way up to "sample." which
leaves you with the "*" filename with no path. Now pass that to another
fileset's "includes" attribute and you have a fileset with flattened files.
Is that close to what you wanted?
Jake
At 05:48 PM 9/24/2002 -0400, you wrote:
>This stems from the fact I don't believe I can use wildcards in the p4edit
>task.
>(Someone correct me if I'm wrong, please!) So I do want to iterate on
>files that
>do exist. :-) Really, it isn't really foreach's responsibility, but it comes
>close to being able to help.
>
><mapper> would make a nice <foreach> element for other tasks too I imagine...
>
>Anyone have any ideas how I can get a flattened list of file names from a
>fileset? or iterate over a directory in Perforce?
>
>thanks!
>
>dM
>
>
>
>
>
>
>-----Original Message-----
>From: Erik Hatcher [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, September 24, 2002 4:22 PM
>To: Ant Users List
>Subject: Re: applying mappers to fileset
>
>
>Again, a fileset only works on *existing* files, so flattening it would
>give a set of filenames that don't exist (yet?).
>
>It makes sense for <foreach> to support a mapper though.
>
> Erik
>
>
>Duane Mattos wrote:
> > I guess I'd like to create a new fileset from an old one. I'd like to use
> > foreach on the new fileset (or the 'right' side of the map, no longer care
>about
> > the left). I don't think the perforce tasks support wildcards, so I
> thought I
> > could iterate through a fileset, but I need to flatten the filenames.
> >
> > dM
> >
> > -----Original Message-----
> > From: Erik Hatcher [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, September 24, 2002 3:45 PM
> > To: Ant Users List
> > Subject: Re: applying mappers to fileset
> >
> >
> > No. That doesn't really make sense in a general sense, at least to me.
> > A fileset is a set of existing files, so mapping them doesn't preserve
> > that meaning.
> >
> > Mappers are associated directly with several tasks, such as <copy>.
> >
> > What do you have in mind specifically?
> >
> > Erik
> >
> >
> >
> > Duane Mattos wrote:
> >
> >>Can I apply a mapper (flatten in my case) to an arbitrary fileset? How
> do I
> >
> > do
> >
> >>so?
> >>
> >>thanks!
> >>
> >>dM
> >>
> >>--
> >>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> >>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >>
> >>
> >>
> >
> >
> > --
> > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >
> > --
> > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >
> >
> >
>
>
>--
>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>--
>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>