You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mariano Benitez <ma...@fuegolabs.com> on 2003/05/09 14:17:35 UTC

how to set a property with a regexp

I have the following problem:

I have a fileset that I want to convert to the manifest classpath. so 
this is what I do:

1) pathconvert
        <property name="lib.dir.sep" 
value="${basedir}${file.separator}lib${file.separator}"/>
        <pathconvert refid="project.class.path" 
property="manifest.class.path" pathsep=" ">
            <map from="${lib.dir.sep}" to=""/>
        </pathconvert>
        <echo message="${manifest.class.path}"/>

2) the problem comes when trying to make this work fine on both win with 
cygnus and unix.
    the paths in the fileset comes with the path separator of the target 
os, so I change my map so that reflect that.
    the problem is that if the fileset contains another subdirectory 
like lib/tomcat/catalina.jar, the result of the mapping is different on 
each platform,
        in unix is "tomcat/catalina.jar" and in windows is 
"tomcat\catalina.jar"

3) now, how can I set another property but replacing ${file.separator} 
with /?


any suggestions are appreciated!

MAriano



Re: how to set a property with a regexp

Posted by Mariano Benitez <ma...@fuegolabs.com>.
sorry, I worked it out.
the mapping is done before the path separator conversion, so what I have 
to do is set targetos="unix" and the manifest is ok

Mariano Benitez wrote:

> I have the following problem:
>
> I have a fileset that I want to convert to the manifest classpath. so 
> this is what I do:
>
> 1) pathconvert
>        <property name="lib.dir.sep" 
> value="${basedir}${file.separator}lib${file.separator}"/>
>        <pathconvert refid="project.class.path" 
> property="manifest.class.path" pathsep=" ">
>            <map from="${lib.dir.sep}" to=""/>
>        </pathconvert>
>        <echo message="${manifest.class.path}"/>
>
> 2) the problem comes when trying to make this work fine on both win 
> with cygnus and unix.
>    the paths in the fileset comes with the path separator of the 
> target os, so I change my map so that reflect that.
>    the problem is that if the fileset contains another subdirectory 
> like lib/tomcat/catalina.jar, the result of the mapping is different 
> on each platform,
>        in unix is "tomcat/catalina.jar" and in windows is 
> "tomcat\catalina.jar"
>
> 3) now, how can I set another property but replacing ${file.separator} 
> with /?
>
>
> any suggestions are appreciated!
>
> MAriano
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org