Path Separator

In this example, path.separator is used to separate the path and file by semicolon (;).

Ads

Path Separator

     

In this example, path.separator is used to separate the path and file by semicolon (;). When it is run, Ant checks for the path separator and directory separator characters provided by the underlying JVM and uses those values. It successfully interprets either the ";" or the ":" inside the build file. For example, when run on Unix machine, ant interprets the path dir;dir\\subdir correctly as the dir;dir\\subdir. Separator must be used consistently with in the same value type; the string dir;dir\\subdir, combining a windows path separator (;) and a Unix directory separator (/) is not a good form. 

 

 

 

<project name="PathSeperator" default="echo" basedir=".">

  <target name="echo">
  <echo message="File: ${basedir}${path.separator}build.xml"/>
  <echo message="Path: ${basedir}${path.separator}build.xml${path.separator}
   ${basedir}${path.separator}build.properties"/>
  </target>

</project>

The following output will be displayed if you execute ant command on the command prompt with appropriate path. 


Download Source Code

     

Advertisements

Share on Google+Share on Google+

Path Separator

Posted on: September 6, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: Path Separator  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads