You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Aaron Haspel <aa...@eredyne.com> on 2001/05/23 23:40:14 UTC
wildcards in replace
Is there any way to use wildcard characters in the replace task in addition to some combination of properties and string literals? What I want to do is convert an absolute directory path (say, "/home/aaron", but it could be some path of which I have no advance knowledge) to the last directory in that path ("aaron"), and I'm trying something like this:
<replace "${user.home}" token="**/" />
which fails: "/home/aaron" becomes "home/aaron", nothing is replaced at all. Is there any way in ant to get what I want?
Thanks for an informative list,
Aaron
Re: wildcards in replace
Posted by Aaron Haspel <aa...@eredyne.com>.
Actually one way to solve my problem is to use the shell string operators, as follows:
<exec executable="echo" >
<arg line="current_dir=${PWD##/*/}>build.properties" />
</exec>
<property file="build.properties" />
This will set a property named current_dir to the last directory of the current absolute path. There is probably a more elegant way to do it, if anyone has suggestions.
Aaron
----- Original Message -----
From: Aaron Haspel
To: ant-user@jakarta.apache.org
Sent: Wednesday, May 23, 2001 5:40 PM
Subject: wildcards in replace
Is there any way to use wildcard characters in the replace task in addition to some combination of properties and string literals? What I want to do is convert an absolute directory path (say, "/home/aaron", but it could be some path of which I have no advance knowledge) to the last directory in that path ("aaron"), and I'm trying something like this:
<replace "${user.home}" token="**/" />
which fails: "/home/aaron" becomes "home/aaron", nothing is replaced at all. Is there any way in ant to get what I want?
Thanks for an informative list,
Aaron
RE: