Hi !
I tried that and it fixes the first substitution (i.e. the path now only contains '/', 
however
internally represented with \\ when dumped to a file), thanks. the second one still 
does not work.
if I try to hardcode
<replace file="${tmp.properties}" token="C\:\\Data\\1671sc\\src\\dao\\main\\" value="" 
summary="yes"/>
this is working fine. I'd have however hope that the replace task would have been 
transparent of the OS
(then how to know the string is a path ? o.k).
I'll make it work by replacing the generated string in the property file as a UNIX 
path, the performing
the replacment.
still wondering if there could be a direct way to assign a property to its 'display' 
representation
instead of its internal java representation (with escaped '\' for instance) - more 
direct than
pathconvert for instance ?
seb.


"W. Sean Hennessy" wrote:

>  the tail element
>  with hard coded *nix slash (aka virgule) "dao/main"
>  looks to be sourced/generated from ${source.dir} property.
>  that would be a good candidate for the use of ${file.separator}
>
> -----Original Message-----
> From: Sebastien Blanc [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 01, 2003 10:02 AM
> To: Ant Users List
> Subject: Re: r_e_m_o_v_e a string within a path
>
> <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:[EMAIL PROTECTED]
> > > Sent: Tuesday, July 01, 2003 9:20 AM
> > > To: [EMAIL PROTECTED]
> > > 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: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to