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) <nageshbl...@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.
>

Reply via email to