<?xml version="1.0"?>
 <project name="pathconvert" default="generate_classpath">

  <target name="init">
   <condition property="build.os.windows">
     <os family="windows"/>
   </condition>
   <condition property="build.os.unix">
     <os family="unix"/>
   </condition>
  </target>

  <target name="gen_windows_classpath" if="build.os.windows">
    <property name="target.os"             value="windows" />
    <property name="path.prefix.token"     value="B:\prefix" />
    <property name="dirs.opt.lib"          value="O:\lib\shared" />
  </target>

  <target name="gen_unix_classpath" if="build.os.unix">
    <property name="target.os"             value="unix" />
    <property name="path.prefix.token"     value="/prefix" />
    <property name="dirs.opt.lib"          value="/opt/lib/shared" />
  </target>

  <target name="generate_classpath" 
		  depends="init, gen_windows_classpath, gen_unix_classpath">

    <!--
     - Open Source or other jar-only libraries.
	-->
    <property name="path.jdsl" 
			  value="${path.prefix.token}/jdsl-2.0.5/lib/jdsl.jar"/>
    <property name="path.jdom" 
			  value="${path.prefix.token}/jdom-b6/build/jdom.jar" />

    <path id="path.opt.lib.tmpl">
	  <pathelement location="${path.jdsl}" />
      <pathelement location="${path.jdom}" />
	</path>
	<pathconvert targetos="${target.os}" 
				 property="classpath.opt.lib" 
				 refid="path.opt.lib.tmpl" >
      <map from="${path.prefix.token}" to="${dirs.opt.lib}" />
    </pathconvert>

	<path id="classpath">
	  <pathelement path="${classpath.opt.lib}"/>
	</path>
	
	<property name="what.is.classpath" refid="classpath"/>
    <echo message="what.is.classpath=${what.is.classpath}" />
 </target>
</project>