ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject RE: How can one copy paths in a property somewhere?
Date Thu, 13 Dec 2001 19:46:44 GMT
--- Hannes van der Merwe <Hannesv@meb.co.za> wrote:
> How would you do that exactly, because there is nothing involving
> properties in the documentation under the copy target?

Sorry -- I guess that reply was a bit vague (yesterday was a bit
rushed)...

I meant: Reference the (comma-separated list) property in the <fileset>
element for the <copy> task. For example:

  <property name="FILES" value="a.dat:b.dat:c.dat"/>

  <target name="doCopy">
    <pathconvert pathsep="," property="FILES.list">
      <path>
        <pathelement path="${FILES}"/>
      </path>
      <map from="${basedir}${file.separator}" to=""/>
    </pathconvert>
    <copy todir="tmp">
      <fileset dir="." includes="${FILES.list}"/>
    </copy>
  </target>

The pathsep="," converts the colons to commas, and the <map> turns the
files back into their simple filenames, which is necessary because a)
<path> turns them into full-path filenames, and b) <fileset> can't handle
full-path filenames (not sure why <copy> doesn't allow a list of names
instead of insisting on either one file in the "file" attr or a set of
files derived via <fileset>, since that seems oddly limiting to me -- but
I suspect if I complained about it, someone would just tell me to fix it,
so you didn't hear if from me :)

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

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


Mime
View raw message