ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: How to replace substring into property and get result into another property ?
Date Tue, 29 Aug 2006 14:41:46 GMT
--- Mathieu Champlon <m.champlon@free.fr> wrote:

> Willy Reinhardt a écrit :
> > Hi, 
> > I get a property value as : 
> >
>
lib/iaik/iaik_jce.jar,lib/iaik/iaikPkcs11Provider.jar
> 
> >
> > and would replace character "," by ";" or ":" 
> >
> > is a ant task can do that ? 

In this case, having a property value as described
above, it is pretty clear that the files described by
the property share a common root (probably the
project's basedir).  Deriving a path-like format is
easy:

Given property "foo":

<pathconvert property="bar">
  <path>
    <fileset dir="${basedir}" includes="${foo}" />
  </path>
</pathconvert>

property "bar" will contain the formatted path.  The
use of <fileset> assumes that the named files exist. 
If they may not, you could use

  <filelist dir="${basedir}" files="${foo}" />

instead.

Note that in either case, ${bar} will contain absolute
pathnames.  If this is a problem, you should be able
to get rid of the leading path with <pathconvert>'s
(older) nested <map> elements, or nested file
<mapper>s as detailed in the manual.

Finally, the fact that the files in this example are
jar files suggests that you may not actually need a
property to store the path.  If you are using e.g.
<java> or another Ant task that requires a classpath,
we have already seen how to build the path object from
your input property.

HTH,
Matt


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Mime
View raw message