On Mon, 25 Feb 2002, Otto Perdeck <[EMAIL PROTECTED]> wrote:

> I need to check whether certain executables are available in my Ant
> build script. Depending on availability, parts of the build would be
> executed or not.

You can use <available> using the file attribute for the name of the
executable and the filepath attribute set to the value of the PATH
environment variable.

untested:

<property environment="env" />
<condition property="foo-command-present">
  <or>
    <available file="foo" filepath="${env.PATH}" />
    <!-- special case for Windows, may be PATH or Path -->
    <available file="foo.exe" filepath="${env.Path}" />
    <available file="foo.exe" filepath="${env.PATH}" />
  </or>
</condition>

Stefan

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to