ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry V. Streepy, Jr." <>
Subject new pathconvert task
Date Fri, 01 Jun 2001 21:36:20 GMT
A few days ago I posted a question regarding a task to convert a path
between windows and unix formats.  Since I got no responses, I when
ahead and wrote it.

Some background:

The property task supports this form:

     <property name="rt.path" refid="rt.path"/>

Assuming "rt.path" is a valid reference to a path, this stores the whole
path in the specified property.  Note that the format of the path stored
in the property is determined by the current operating system.

In our build, I need to generate batch files and shell scripts with
correct path structures for both unix and windows regardless of the
platform on which I am building.

So, I developed the "pathconvert" task to help out.  Like the property
task above, the results are stored in a property.  A "targetos"
attribute determines the format of the path structure generated.  Here's
an example:

    <pathconvert targetos="unix" property="newpath">
        <pathelement location="${wl.home}/lib/weblogicaux.jar" />
        <pathelement location="${wl.home}/classes" />
        <pathelement location="${wl.home}/mssqlserver4/classes" />
        <pathelement location="c:\winnt\System32" />
      <map from="d:" to="/foo"/>
      <map from="c:" to="/bar"/>

Most of the above is obvious, but you should read the attached
documentation for the details.  Source code is also attached.  Note that
I placed the new task in the ant taskdefs package, you may want to
change that.  As with any new task, you need to place this line
somewhere in you build file:

<taskdef name="pathconvert"

Larry V. Streepy, Jr.
Chief Technical Officer and VP of Engineering

Health Language, Inc.  -- "We speak the language of healthcare"
A subsidiary of CyberPlus Corp.

970/626-5028 (office) 
970/626-4425 (fax)    
View raw message