ant-dev mailing list archives

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

----- Original Message -----
From: "Nico Seessle" <>
To: <>
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
> Unfortunately there does not seem to be a good solution to this problem.
> available-task simply gets handed over file from the "parser" and the
> constructs these files using the "basedir". First solution would be to
> 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
> 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.


View raw message