--- Richard Russell <[EMAIL PROTECTED]> wrote:
> I tried using <for> and <var>, but found that I
> couldn't do much with 
> <var>, as it appeared that the only way I could set
> the var was with the 
> <var> task, and I needed to use functionality in
> <propertycopy> to get 
> double-redirection. I can't *quite* recall why this
> didn't work, but it 
> didn't. If you like, I'll try to recreate what I was
> trying to do, and see 
> if I can demonstrate the problem I had...

Okay... my understanding of the problem was that you
had a set of files whose contents you wanted to append
to identically named files in another location... so I
am ignoring recursive property resolution because I
don't see how it applies... <var> is for use with
<pathconvert>.  You don't *really* need it, but here I
would use it personally.  Even better would be local
properties for macros, but that's another story... so
we are going to use <for> and <concat>...

> I'm not sure what <pathconvert> can do for me
> here... A mapper sounds more 
> useful (eg <globmapper from="${dir1}/*"
> to="${dir2}/*"/>), but I don't think it can be used
> with <concat> ...

Ah, but since 1.6.2 <pathconvert> supports a nested
<mapper>.  Actually before that it also supported
limited mapping via its <map> subelements, but I'm
personally more comfortable with <mapper>s so that's
what we'll use here... the following is untested:

<property name="dest.dir" location="dest" />
<property name="src.dir" location="src" />

<!-- mapper may not be perfect; experiment -->
<mapper id="src2dest" type="glob"
        from="${src.dir}/*" to="${dest.dir}/*" />

<for param="f">
  <fileset id="fs" dir="${src.dir}" includes="*" />
  <sequential>
    <!-- unset so we can reuse -->
    <var name="destfile" unset="true" />
    <fileset id="f" file="@{f}" />
    <pathconvert property="destfile">
      <path>
        <fileset refid="f" />
      </path>
      <mapper refid="src2dest" />
    </pathconvert>
    <concat destfile="${destfile}" append="true">
      <fileset refid="f" />
    </concat>
  <sequential>
</for>

As you can see, I only used <var> to unset the
destfile property.  The alternative is to use a
different property for every file... @{f}.dest
perhaps, but large numbers of dynamically generated
property names just feels wrong to me.  That's an old
argument.  Anyway, the above should be somewhere in
the neighborhood assuming I understood the problem
correctly...

-Matt



                
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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

Reply via email to