You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Sebastien Blanc <Se...@alcatel.com> on 2003/07/01 18:15:22 UTC

remove a string within a path

Hi !

I'm trying to remove a source directory from a path (in a property). I
don't want to use ReplaceRegExp for now but I think that would be the
same pb anyway (not looking at a <script> solution either).

I tried the following:

   <property name="tmp.properties" value="tmp.properties" />
   <propertyfile file="${tmp.properties}">
       <entry key="tmp.package" value="${xml.source.dir}"/>
   </propertyfile>
   <replace file="${tmp.properties}" token="${source.dir}" value="" />
   <property file="${tmp.properties}" />
   <echo>package name = ${tmp.package}</echo>

I however get no transformation.

when I echo ${source.dir} and ${xml.source.dir} I get the following:

[echo] removing C:\Data\1671sc\src\dao/main from
C:\Data\1671sc\src\dao\main\com\alcatel\gem\ne1671\R01_00_00\dao\xml

also after the <property call> I get (WIN32):
tmp.package=C\:\\Data\\1671sc\\src\\dao\\main\\com\\alcatel\\gem\\ne1671\\R01_00_00\\dao\\xml

in the tmp.properties file.

do I need to make a first pass to escape all '/' and '\' in
${source.dir} or this there an easiest to remove a string from a path in
a portable way ?

thanx.

seb.


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