ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron Haspel" <aa...@eredyne.com>
Subject Re: wildcards in replace
Date Wed, 23 May 2001 22:37:57 GMT
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

Mime
View raw message