ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastien Blanc <Sebastien.Bl...@alcatel.com>
Subject Re: r_e_m_o_v_e a string within a path
Date Tue, 01 Jul 2003 17:01:45 GMT
<replace file="${tmp.properties}" token="/" value="\${file.separator}" summary="yes"/>
is better than
<replace file="${tmp.properties}" token="/" value="${file.separator}" summary="yes"/>.
the latest substituion (remove the source dir at the beginning) still does not occure.
seb.

Sebastien Blanc wrote:

> Hi Sean !
>
> I'd like not to edit the file by hand (i.e. I want to extract the package name on the
fly); here
> is however what I tried with the file separator and reloading into a new property after
replacing
> any '\' by the file separator:
>
> <replace file="${tmp.properties}" token="/" value="${file.separator}${file.separator}}"
> summary="yes"/>
> <property file="${tmp.properties}" />
> (2 file separators otherwise I get daomain; that should be OK on UNIX too).
>
> I however still have no substitution:
>
>      [echo] [AlarmsRootCfg.xml] DAO generation using stylesheet [EMARootCfgDAO.xslt].
>      [echo] removing C:\Data\1671sc\src\dao/main from
> C:\Data\1671sc\src\dao\main\com\alcatel\gem\ne1671\R01_00_00\dao\xml
> [propertyfile] Creating new property file: C:\Data\1671sc\src\dao\tmp.properties
>   [replace] Replacing in C:\Data\1671sc\src\dao\tmp.properties: / --> \\
>   [replace] Replaced 1 occurrences in 1 files.
>  [property] Loading C:\Data\1671sc\src\dao\tmp.properties
>      [echo] removing C:\Data\1671sc\src\dao\main from
> C:\Data\1671sc\src\dao\main\com\alcatel\gem\ne1671\R01_00_00\dao\xml
>   [replace] Replacing in C:\Data\1671sc\src\dao\tmp.properties: C:\Data\1671sc\src\dao\main
-->
>   [replace] Replaced 0 occurrences in 0 files.
>      [echo] package name = C:\Data\1671sc\src\dao\main\com\alcatel\gem\ne1671\R01_00_00\dao\xml
>
> strange because here is the tmp.properties file spawned:
> tmp.source.dir=C\:\\Data\\1671sc\\src\\dao\\main
> tmp.package=C\:\\Data\\1671sc\\src\\dao\\main\\com\\alcatel\\gem\\ne1671\\R01_00_00\\dao\\xml
>
> here is the latest XML I'm using:
>
>   <echo>removing ${source.dir} from ${xml.source.dir}</echo>
>   <property name="tmp.properties" value="tmp.properties" />
>    <propertyfile file="${tmp.properties}">
>        <entry key="tmp.source.dir" value="${source.dir}"/>
>        <entry key="tmp.package" value="${xml.source.dir}"/>
>    </propertyfile>
>    <replace file="${tmp.properties}" token="/" value="${file.separator}${file.separator}"
> summary="yes"/>
>    <property file="${tmp.properties}" />
>   <echo>removing ${tmp.source.dir} from ${tmp.package}</echo>
>    <replace file="${tmp.properties}" token="${tmp.source.dir}" value="" summary="yes"/>
>    <property file="${tmp.properties}" />
>    <!-- <delete file="${tmp.properties}"/> -->
>    <echo>package name = ${tmp.package}</echo>
>
> is there any way to access the ANT internal string representation without any interpretation
?
> thanx.
>
> seb.
>
> "W. Sean Hennessy" wrote:
>
> > what happens if you change the line in your tmp.properties file.
> > from "dao/main"
> > to "dao${file.separator}main"
> >
> > -----Original Message-----
> > From: Sebastien Blanc [mailto:Sebastien.Blanc@alcatel.com]
> > Sent: Tuesday, July 01, 2003 9:20 AM
> > To: user@ant.apache.org
> > Subject: r_e_m_o_v_e 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
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org


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


Mime
View raw message