ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Parag Doke <parag.d...@gmail.com>
Subject Re: Set properties based on Operating System.
Date Mon, 17 Oct 2011 14:18:57 GMT
I read this somewhere (don't recollect where) ... and thought you might find
it useful too.

Let us say you save the 2 property sets in files unix.properties and
windows.properties.
Then all you need in the ant file is <property
file="${os.family}.properties"/>

HTH,
Parag Doke
Save paper, save trees. Do not print emails/documents unless absolutely
necessary.


2011/10/17 ನಾಗೇಶ್ ಸುಬ್ರಹ್ಮಣ್ಯ (Nagesh S) <nageshblore@gmail.com>

> Hi,
> I would like to set the values of properties' names differently based on
> the
> OS where the build file would run. Is this already covered ?
>
> Basically, I would like to have something as follows. The os tag has values
> set in the same way as it happens with os attribute in exec task. In the
> exec task shown below, the properties are automatically set based on the
> OS.
>
> <Os name="Unix">
> <property name="foo" location="/usr/bin/foo"/>
> <property name="foo.home" location="/etc/config/foo.config"/>
> </Os>
>
> <Os name="Windows">
> <property name="foo" location="C:\foo.exe"/>
> <property name="foo.home" location="C:\foo\foo.config"/>
> </Os>
>
> <exec executable="${foo}><arg value="${foo.home}"/></exec>
>
> N.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message