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 -----
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

Reply via email to