next up previous contents index
Next: Property Up: PathConvert Previous: Parameters specified as nested   Contents   Index

Examples

In the examples below, assume that the ${wl.home} property has the value d: ${\backslash}{\backslash}$weblogic, and ${wl.home.unix} has the value /weblogic.

Example 1

    <path id="wl.path">
      <pathelement location="${wl.home}/lib/weblogicaux.jar"/>
      <pathelement location="${wl.home}/classes"/>
      <pathelement location="${wl.home}/mssqlserver4/classes"/>
      <pathelement location="c:\winnt\System32"/>
    </path>
    
    <pathconvert targetos="unix" property="wl.path.unix" refid="wl.path">
      <map from="${wl.home}" to="${wl.home.unix}"/>
      <map from="c:" to=""/>
    </pathconvert>
will generate the path shown below and store it in the property named wl.path.unix.

/weblogic/lib/weblogicaux.jar:/weblogic/classes:/weblogic/mssqlserver4/classes:/WINNT/SYSTEM32

Example 2
Given a FileList defined as:

  <filelist id="custom_tasks.jars"
        dir="${env.HOME}/ant/lib"
        files="njavac.jar,xproperty.jar"/>
then:
    <pathconvert targetos="unix" 
     property="custom_tasks.jars" refid="custom_tasks.jars">
      <map from="${env.HOME}" to="/usr/local"/>
    </pathconvert>
will convert the list of files to the following Unix path:

/usr/local/ant/lib/njavac.jar:/usr/local/ant/lib/xproperty.jar

Example 3

    <fileset dir="${src.dir}" id="src.files">
      <include name="**/*.java"/>
    </fileset>
  
    <pathconvert pathsep="," property="javafiles" refid="src.files"/>
This example takes the set of files determined by the fileset (all files ending in .java), joins them together separated by commas, and places the resulting list into the property javafiles. The directory separator is not specified, so it defaults to the appropriate character for the current platform. Such a list could then be used in another task, like javadoc, that requires a comma separated list of files.



Andrew Marlow 2003-07-08