ant convert path separator -


within ant file, trying convert windows style path separators unix style. have following:

<path id="basedir.path">     <!-- ${basedir} project attribute. -->     <pathelement path="${basedir}" /> </path> <pathconvert property="adjusted_basedir" refid="basedir.path">     <mapper>         <globmapper from="*" to="*" handledirsep="yes"/>     </mapper> </pathconvert> <echo level="verbose" message="basedir: ${basedir}" />  <echo level="verbose" message="adj basedir: ${adjusted_basedir}" /> 

but output of adjusted_basedir same basedir. have tried using

<mapper type="regexp" from="\\" to="/" /> 

but output of adjusted_basedir "/". how convert path separators windows unix style? want avoid using add-ons ant (so ant-contrib out).

try using filtermapper:

<pathconvert property="adjusted_basedir" refid="basedir.path">     <filtermapper>         <replacestring from="\" to="/" />     </filtermapper> </pathconvert> 

see https://ant.apache.org/manual/types/mapper.html.

there attribute in pathconvert task:

<pathconvert property="adjusted_basedir" refid="basedir.path" dirsep="/" /> 

Comments