tags:

views:

80

answers:

1

Hi All

I have an Ant build that has this line in it:

WORKSPACE.dir = ${basedir}/../

I then have:

CORE_PROJECT.dir= ${WORKSPACE.dir}/UUI_Core

which means that I end up with paths like this:

C:\dev\workspaces\RTC\UUI_Core_ANT/..//UUI_Core

This works fine in almost all cases but I am trying to build a list of classes to be used in a build. At the moment I have this code:

<pathconvert 
 property="coreClasses" 
 pathsep=" " 
 dirsep="." 
 refid="coreSources">
 <map from="C:\dev\workspaces\RTC\UUI_Core\src\" to="" />
 <mapper>
  <chainedmapper>
   <globmapper from="*.mxml" to="*"/>
  </chainedmapper>
  <chainedmapper>
   <globmapper from="*.as" to="*"/>
  </chainedmapper>
 </mapper>
</pathconvert>

Which does the job of removing the file location and jsut leaving the package structure. It is not very flexible though. I should be able to use CORE_PROJECT.dir here.

So, how can I convert

C:\dev\workspaces\RTC\UUI_Core_ANT/..//UUI_Core

to

C:\dev\workspaces\RTC\UUI_Core

+5  A: 
WORKSPACE.dir = ${basedir}/../

This is not a valid Ant syntax.

To convert .. you should use location attribute of the <property> task instead of value. location substitutes the attribute value with an absolute path. In your case:

<property name="WORKSPACE.dir" location="${basedir}/.."/>

EDIT: I should add, always use location attribute when setting path-like properties.

Alexander Pogrebnyak