27
Aug
09

replacing a windows path with a unix one using ant



If for some reason ant interprets your backslashes and you need slashes to make your thing work, here’s a snippet that will convert your windows style path to a unix style one :

  1. <target name="replace-path-example">
  2.   <property name="WIN_PATH" refid="some.path"/>
  3.   <echo message="${WIN_PATH}" file="temp.file"/>
  4.   <replace file="temp.file" token="\" value="/"/>
  5.   <loadfile srcfile="temp.file" property="UNIX_PATH"/>
  6.   <echo message="path is ${UNIX_PATH}"/>
  7.   <delete file="temp.file"/>
  8. </target>

Advertisements

0 Responses to “replacing a windows path with a unix one using ant”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Blog Stats

  • 219,796 hits

%d bloggers like this: