ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Thommes <>
Subject Environment Variable Retrieval in Future Ant Versions
Date Tue, 05 Mar 2002 11:55:54 GMT

I would like to read an environment variable on a Windows machine, for
example SystemRoot.

Since the environment variable retrieval in Ant is case-sensitive, I cannot
be sure that 

<property environment="env" />
<property name="SystemRoot" value="${env.SystemRoot}" />

will always return a value. I, therefore, would like to have a default
value, if no value is available.

In Ant1.4.1 I am using the following code to accomplish this:

<?xml version="1.0"?>
<project name="test_env" default="all" basedir=".">
        <target name="all">
                <property environment="env" />
                <property name="tmp.SystemRoot" value="${env.SystemRoot}" />
                <condition property="SystemRoot" value="C:\WINNT">
                                <equals arg1="${tmp.SystemRoot}"
                <property name="SystemRoot" value="${tmp.SystemRoot}" />
                <echo message="SystemRoot: ${SystemRoot}" />    

Is the condition statement going to work the same way in future versions of
Ant (1.5+)?


GMX - Die Kommunikationsplattform im Internet.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message