this is your problem:
<echo message="directory::exists('${build.dir}') =
${directory::exists('${build.dir}')}"/>
^^^^^^^^^^^^^^
don't quote variable names inside expressions - they will be treated as literal
strings. Use:
${directory::exists(build.dir)} instead.
The reason you're seeing mixed true and false output is this:
1) test that a directory called ${build.dir} exists ( literally that name -
including the $ and {} - returns false
2) test that a directory called build exists. Returns true.
Ian
Malcolm Anderson wrote:
I'm using nant 0.85 rc3 on an xppro box
I am using a variable to hold the word "build" (which is my build directory)
however, directory::exists seems to be working unexpectedly.
specifically notice that what looks like "exists('build')" seems to return both
true and false.
Am I missing something obvious?
Thanks
Malcolm
Here's my script foo
<target name="foo">
<property name="build.dir" value="build" />
<echo message="build.dir = '${build.dir}'"/>
<echo message="directory::exists('${build.dir}') =
${directory::exists('${build.dir}')}"/>
<echo message="directory::exists('bin') = ${directory::exists('bin')}"/>
<echo message="directory::exists('build') =
${directory::exists('build')}"/>
<echo message="attempting to delete build dir"/>
<delete dir="${build.dir}" if="${directory::exists('${build.dir}')}"/>
<echo message="directory::exists('build') =
${directory::exists('build')}"/>
</target>
now here's my results
**************
NAnt 0.85 (Build 0.85.1869.0; rc2; 2/12/2005)
Copyright (C) 2001-2005 Gerry Shaw
http://nant.sourceforge.net
Buildfile: file:///C:/Program
Files/CruiseControl.NET/server/Hegemony/WorkingDirectory/Hegemony.build
Target framework: Microsoft .NET Framework 1.1
Target(s) specified: foo
foo:
[echo] build.dir = 'build'
[echo] directory::exists('build') = False
[echo] directory::exists('bin') = False
[echo] directory::exists('build') = True
[echo] attempting to delete build dir
[echo] directory::exists('build') = True
BUILD SUCCEEDED
Total time: 0.1 seconds.
**************
"Oh Bother!" said the Borg, "We just assimilated Pooh."
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users