ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <stev...@iseran.com>
Subject Re: <available> problem
Date Tue, 20 Mar 2001 00:23:20 GMT

----- Original Message -----
From: "Nico Seessle" <nico@apache.org>
To: <ant-dev@jakarta.apache.org>
Sent: Monday, March 19, 2001 16:13
Subject: Re: <available> problem



> <?xml version="1.0"?>
> <project name="test" default="default" basedir=".">
>   <target name="default">
>    <available file="" property="yes"/>
>    <echo message="${yes}"/>
>   </target>
> </project>
>
> results in
>
> Buildfile: build.xml
>
> default:
>      [echo] true
>
> BUILD SUCCESSFUL.
>
> Unfortunately there does not seem to be a good solution to this problem.
The
> available-task simply gets handed over file from the "parser" and the
parser
> constructs these files using the "basedir". First solution would be to
pass
> a String to available and let it construct the file itself (failing if the
> passed filename is the empty string); second solution would be to declare
it
> correct and don't change it :-)

I've come across this before, and chose solution two. But you can do a test
for the file being passed in being a directory, which some tasks may opt to
reject. So if <available dir="" > set a property if a directory existed and
and available file="" set something to false as it was really a directory
then you may have a better solution. but perhaps the available file="" test
should raise an error because it was passed a directory, rather than return
false. Tough choice. Again, option two looks nice.

-steve


Mime
View raw message