ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: Any way to test if on unix/linux, mac, windows, etc?
Date Fri, 21 Sep 2001 11:52:00 GMT

I'm using the following to set paths based on O/S (Ant 1.3), and it appears
to work but it does mean you have to find a file that's uniq to your O/S and
you have more than 1 properties file ( for NT, and for UNIX)!

	<target name="setProperties">
		<echo message="Set base environment variables from
		<property file="${ssab.propertyFile}"/>	

	<target name="validate">
		<available property="ssab.propertyFile"
value="" file="c:\autoexec.bat"/>
		<available property="ssab.propertyFile"
value="" file="/dev/null"/>

	<target name="init" depends="validate,setProperties">
		<property name="ssab.distributionLatest"
		<property name="ssab.distributionArchive"
		<!-- Create the build directory structure used by compile
		<mkdir dir="${ssab.classesDir}"/>
		<mkdir dir="${ssab.libDir}"/>

-----Original Message-----
From: Kevin Duffey []
Sent: 21 September 2001 05:56
Subject: Any way to test if on unix/linux, mac, windows, etc?


I have built scripts for windows only, and now I need a "cross-platform" 
script. Almost everything in the script should work fine to build my java 
projects, but I do have the problem of "paths". I am wondering if there is 
a way to conditionally check and/or set the path based on the platform it 
is being run on?


Halifax plc, Registered in England No. 2367076.  Registered Office: Trinity Road, Halifax,
West Yorkshire HX1 2RG. Represents only the Halifax Financial Services Marketing Group for
the purposes of advising on and selling life assurance, pensions and unit trust business.
 The Marketing Group is regulated by the Personal Investment Authority.  Switchboard 01422


View raw message