ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob van Oostrum" <rva...@xs4all.nl>
Subject Re: Bug 3129 - <which> task proposal
Date Tue, 10 Sep 2002 07:43:51 GMT
Sounds like what you're really looking for is an Ant-version of the which
command.

Something like <which basedir="." file="ssh.eze" property="ssh.exe" /> where
basedir is optional and represents the directory from which to run 'which'.

Should be easy enough for Linux/Unix. Not sure how I would prefer to do this
on Win32 though. For users with the cygwin bin directory in their paths the
task could use cygwin which (check with <available file="which" ...). If
this doesn't fly, the task should probably append the filename to each path
element and run an <available> until it finds a match or runs out of path
elements . Anybody working on this yet? Any suggestions?


cheers
Rob

----- Original Message -----
From: "Stefan Bodewig" <bodewig@apache.org>
To: <ant-dev@jakarta.apache.org>
Sent: Tuesday, September 10, 2002 8:18 AM
Subject: Re: Bug 3129


> On Mon, 9 Sep 2002, Dominique Devienne <DDevienne@lgc.com> wrote:
>
> > You can get the absolute pathname of your executable on Win32 using:
> >
> > <available property="ssh.exe" file="ssh.exe" filepath="${env.Path}"
> > />
> >
> > and use ${ssh.exe} thereafter.
>
> Are you sure?
>
> I'd think this property would be either unset or "true" after that
> task.  Yep:
>
> [bodewig@bodewig bodewig]$ cat > /tmp/ssh.xml
> <project default="foo">
>   <target name="foo">
>     <property environment="env"/>
>     <available property="ssh" file="ssh" filepath="${env.PATH}"/>
>     <echo>${ssh}</echo>
>   </target>
> </project>
> [bodewig@bodewig bodewig]$ ant -f /tmp/ssh.xml -verbose
> Apache Ant version 1.6alpha compiled on September 9 2002
> Buildfile: /tmp/ssh.xml
> ...
> foo:
>  [property] Loading Environment env.
> [available] Found: ssh in /usr/bin
>      [echo] true
>
> BUILD SUCCESSFUL
> Total time: 3 seconds
>
> Stefan
>
> --
> To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message