> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Helmut Dipper
> Sent: woensdag 22 december 2004 11:02
> To: nant-users@lists.sourceforge.net
> Subject: Re: [Nant-users] inconsistence between 
> environment::variable-exists and sysinfo
> 
> Gert Driesen wrote:
> > 
> > Helmut,
> > 
> > Properties are case-sensitive, and the case of the 
> environment variables
> > differs from system to system, so there's isn't much we can 
> do about this.
> > 
> > We recommend using the environment functions, and consider 
> deprecating the
> > <sysinfo> task :
> > 
> > http://nant.sourceforge.net/nightly/latest/help/tasks/sysinfo.html
> > 
> > Hope this helps,
> > 
> > Gert
> > 
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] On Behalf Of
> > > Helmut Dipper
> > > Sent: dinsdag 21 december 2004 13:07
> > > To: nant-users@lists.sourceforge.net
> > > Subject: [Nant-users] inconsistence between
> > > environment::variable-exists and sysinfo
> > >
> > > Hello,
> > >
> > > in NAnt 0.85-rc1 following inconsistence exists:
> > > environment::variable-exists delivers "true" for
> > > both 'SystemRoot' and 'SYSTEMROOT' (case-insensitive?)
> > > but task sysinfo defines sys.env.SystemRoot or (exclusive)
> > > sys.env.SYSTEMROOT dependend on the environment:
> > > in a DOS-shell environment sys.env.SystemRoot is defined
> > > in a cygwin-bash environment sys.env.SYSTEMROOT is defined.
> > > For proof execute
> > >    <if test="${environment::variable-exists('SystemRoot')}">
> > >       <echo message="env-var 'SystemRoot' exists"/>
> > >    </if>
> > >    <if test="${environment::variable-exists('SYSTEMROOT')}">
> > >       <echo message="env-var 'SYSTEMROOT' exists"/>
> > >    </if>
> > >    <if test="${property::exists('sys.env.SystemRoot')}">
> > >       <echo message="property 'sys.env.SystemRoot' exists"/>
> > >    </if>
> > >    <if test="${property::exists('sys.env.SYSTEMROOT')}">
> > >       <echo message="property 'sys.env.SYSTEMROOT' exists"/>
> > >    </if>
> > >
> > > So although environment::variable-exists('SYSTEMROOT')
> > > delivers "true", after task sysinfo property sys.env.SYSTEMROOT
> > > may be NOT DEFINED.
> > >
> > > Workaround to be inserted after <sysinfo/>:
> > >    <if test="${property::exists('sys.env.SystemRoot') and not
> > > property::exists('sys.env.SYSTEMROOT')}">
> > >       <property name="sys.env.SYSTEMROOT"
> > > value="${sys.env.SystemRoot}"/>
> > >    </if>
> > >    <if test="${property::exists('sys.env.SYSTEMROOT') and not
> > > property::exists('sys.env.SystemRoot')}">
> > >       <property name="sys.env.SystemRoot"
> > > value="${sys.env.SYSTEMROOT}"/>
> > >    </if>
> 
> Gert,
> 
> property-names are case-sensitive but the argument
> for the function environment::variable-exists seem to
> be case-insensitive: both calls in the 'proof' deliver
> "true" independent from the environment although for
> both environments the list of environment variables
> contains either "SystemRoot" or "SYSTEMROOT".
> That is the reason for the inconsistency.

I know. The environment::variable-exists uses the
Environment.GetEnvironmentVariable API, which is case-insensitive, while the
<sysinfo> task iterates over all entries returned by
Environment.GetEnvironmentVariables().

I agree that there's an inconsistency between environment::variable-exists
and <sysinfo>, but there's really nothing we can do about that.

You should really consider using environment::get-variable instead of
<sysinfo>.

Gert



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to