Take a look at the <exec> task:
http://ant.apache.org/manual/CoreTasks/exec.html
In addition to the failifexecutionfails = false (to suppress the build failure) you may want
to set the following attributes: resultproperty, errorproperty, outputproperty. Hopefully,
something meaningful, unique and consistent will be written to one of the properties so you
can use a <condition> task to set a property only when an application is not found.
Also instead of inferring the presence/absence of the application by trying to run it, you
mentioned that the executable path is part of the PATH variable...If the path to the application
(or to a unique enough portion of it) must be in the PATH variable you could try <propertyregex>
task (from the ant-contrib project) to set a property if you can find the application path
in the ${env.PATH} variable value.
Hope that helps,
Ninju
----- Original Message ----
From: George Storm <gstorm@divxcorp.com>
To: Ant Users List <user@ant.apache.org>
Sent: Monday, May 14, 2007 5:57:47 PM
Subject: Detecting presence of an application, access to it's return value
Another newbee question:
I need to detect if an application is installed (cross platform). I do not
have direct access to the applications (tool) path as it's installation path
is found as part of my PATH variable.
I would like to try to run it with failonerror set to false and look for the
program's return value. How do I access it in ant?
Thanks,
- George Lawrence Storm, DivX, Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
____________________________________________________________________________________Got a
little couch potato?
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
|