ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Goss" <>
Subject RE: ant apply and file.separator
Date Mon, 13 Jan 2003 19:07:52 GMT
1. Doesn't ${file.separator} just pick up the system file.separator for the
platform?  For example, if I'm running on Windows, the system separator is
'\', so <arg
value="xml${file.separator}stylesheets${file.separator}copyxml.xsl"/> will
turn out to be exactly the opposite of what I want?  I examined Ant's shell
file and it does accommodate Cygwin at launch by modifying path formats to
use forward slashes, but as far as I can tell there's no residual effect
once Ant is running.  Just to make sure I wasn't crazy I tried your
suggestion and the result matched my expectations ... back slashes instead
of forward slashes.

2. You can only use ${file.separator} when you're specifying a path in the
build file.  Ant's <apply> task executes an operation for each file in a
file set.  It constructs the path for the individual files with the help of
a few hints from a <mapper>.  At execution time you can change specify the
location of the file names in an argument list, but there doesn't appear to
be any way to modify the parameters (<sourcefile> and <targetfile>).

    <!-- can't modify targetfile since because
         it is pre-determined by the apply task
    <arg value="-o"/>

In summary, I can see how ${file.separator} is a good solution when
switching between platforms, but the property has to be right to begin with
in order for it to work.  In this case I'm running on a Windows platform but
the executable expects that all paths will be in Unix format.  Since Ant
doesn't really know that, it doesn't make any accommodation.  It seems to me
that Ant often allows for this kind of thing by allowing the developer to
use <pathconvert> etc, but in the case of <apply> that's not allowed.

-----Original Message-----
From: Elizabeth Cooper []
Sent: Monday, January 13, 2003 12:36 PM
To: Ant Users List
Subject: Re: ant apply and file.separator

Try this:

Instead of "hard-coding" the slash in the ant code, use ${file.separator}.
It makes the statement longer but always works.

For example instead of:

you type:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message