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

|