ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <>
Subject RE: Using files in classpath in task file=""
Date Fri, 04 Apr 2003 17:29:52 GMT
On a related subject, one problem I have found is that there
is no portable way right now in ANT to obtain the URL of a file:

Currently we would do something like:

	<property name="fileloc" location="${myfile}"/>
	<property name="fileurl" value="file://${fileloc}"/>

but the number of "//"s is diferent for UNIX(2) and Windows(3),
and you have to do some nasty conditioning. I would like for ANT
to do this for me, transparently.

	<property name="fileurl" locationURL="${myfile}"/>

or somethig like that. You need this for passing file parameters to 

Jose Alberto

> -----Original Message-----
> From: Stefan Bodewig []
> Sent: 03 April 2003 07:18
> To:
> Subject: Re: Using files in classpath in task file=""
> On Wed, 02 Apr 2003, Nicola Ken Barozzi <> wrote:
> > If I had it in jars I could ship it automatically with the jar that
> > has the task that generated index.xml, so I can easily do something
> > like:
> > 
> >   <xslt in="index.xml" out="index.html"
> >         style="resource:/a/style.xsl"/>
> I see.  What I don't see is how we could use an URI here without
> breaking backwards compatibility.
> In XSLTProcess we get the style parameter via setStyle(File), this
> obviously cannot be called with anything else but a file object.  If
> we wanted general URIs, we'd have to change the signature and break
> custom tasks that inherit from or delegate to instances of
> XSLTProcess.  No way.
> I'd rather propose to add an alternative attribute styleURI or
> something to XSLTProcess.
> > Be able to specify a URL for every task that needs a file, and that
> > thus uses the above fileutils method.
> Again, not without changing the tasks to use something else, not File,
> in their setter method and thus severely breaking backwards
> compatibility.
> > Or maybe KISS and just add a getStyleResource(String
> > styleResource). It solves the immediate issue and doesn't open other
> > potential problems.
> Seems the better way to me - at least until we are prepared to break
> API compatibility on almost all tasks at once 8-)
> Stefan
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message