I stand correct Stefan ;-) Thanks for straightening me out. Here's a Which task (summarily tested) that does perform as expected. Cheers, --DD
Debug output (minus class loader stuff) of summary test:
-which:
+User task: which com.lgc.buildmagic.Which
Setting project property: -which-defined -> true
test-which:
+Task: which
Searching P:\com_lgc\dsp\dsp-core\tools\ant\bin
Setting project property: ant.bat ->
P:\com_lgc\dsp\dsp-core\tools\ant\bin\ant.bat
Set property expected = P:/com_lgc/dsp/dsp-core/tools/ant/bin/ant.bat
Setting project property: expected ->
P:/com_lgc/dsp/dsp-core/tools/ant/bin/ant.bat
Set property ant.batU = P:/com_lgc/dsp/dsp-core/tools/ant/bin/ant.bat
Setting project property: ant.batU ->
P:/com_lgc/dsp/dsp-core/tools/ant/bin/ant.bat
Condition true; setting found to true
Setting project property: found -> true
+Task: which
Searching C:\WINNT\system32
Searching C:\WINNT
Searching C:\WINNT\System32\Wbem
Searching C:\pro\exceed\Accessories
Searching C:\pro\bin
Setting project property: cvs.exe -> C:\pro\bin\cvs.exe
cvs.exe = C:\pro\bin\cvs.exe
Summary test:
<target name="test-which" depends="compile, -which">
<which property="ant.bat" basename="ant.bat">
<searchpathelement location="${ant.home}/bin" />
</which>
<pathconvert targetos="unix" property="expected">
<path path="${ant.home}/bin/ant.bat" />
</pathconvert>
<pathconvert targetos="unix" property="ant.batU">
<path path="${ant.bat}" />
</pathconvert>
<condition property="found">
<equals arg1="${ant.batU}" arg2="${expected}" />
</condition>
<fail message="ant.bat = ${ant.batU} != ${expected}"
unless="found" />
<which property="cvs.exe" basename="cvs.exe" searchpath="${env.Path}" />
<echo message="cvs.exe = ${cvs.exe}" />
</target>
<target name="-which" unless="-which-defined">
<taskdef name="which" classname="com.lgc.buildmagic.Which"
classpath="${classes}" />
<property name="-which-defined" value="true" />
</target>
-----Original Message-----
From: Stefan Bodewig [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 10, 2002 1:18 AM
To: [EMAIL PROTECTED]
Subject: Re: Bug 3129
On Mon, 9 Sep 2002, Dominique Devienne <[EMAIL PROTECTED]> 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:
[EMAIL PROTECTED] 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>
[EMAIL PROTECTED] 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
Which.java
Description: Binary data
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
