Tuesday, September 11, 2012

ANT WINDOWS style path and POSIX style path in cygwin

while using ant in windows cygwin, we can not simplely pass a posix style path in ant script,because posix style path like "/cygdrive/c/test" or "/home/atc/" can not be recognized by ant,only recognized by cygwin shell.
so in order to use those posix style path in ant script, we need convert this string into a windows style path,then path to ant,utility cygpath will help to do this kind of converting.


<exec executable="cygpath" outputproperty="app.home.dir">
  <arg value="--windows"/>
  <arg value="/home/atc/chryslerds"/>
</exec>
<echo message="${app.home.dir}"/>

<exec executable="cygpath" outputproperty="ant.dir">
  <arg value="--windows"/>
  <arg value="/cygdrive/c/ant182"/>
</exec>

<echo message="${ant.dir}"/>

No comments:

Post a Comment