You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Rob van Oostrum <rv...@xs4all.nl> on 2002/09/10 09:43:51 UTC
Re: Bug 3129 - task proposal
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" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Tuesday, September 10, 2002 8:18 AM
Subject: Re: Bug 3129
> On Mon, 9 Sep 2002, Dominique Devienne <DD...@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: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Bug 3129 - task proposal
Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Rob van Oostrum" <rv...@xs4all.nl>
To: "Ant Developers List" <an...@jakarta.apache.org>
Sent: Tuesday, September 10, 2002 00:43
Subject: Re: Bug 3129 - <which> task proposal
> 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?
Available does search for a file on a path; this code could be used as the
basis for <which>.
>
>
> cheers
> Rob
>
> ----- Original Message -----
> From: "Stefan Bodewig" <bo...@apache.org>
> To: <an...@jakarta.apache.org>
> Sent: Tuesday, September 10, 2002 8:18 AM
> Subject: Re: Bug 3129
>
>
> > On Mon, 9 Sep 2002, Dominique Devienne <DD...@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:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>