ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: Prompt
Date Mon, 12 Nov 2001 15:51:00 GMT
--- Paul Perevalov <pperevalov@cyber-asp.com> wrote:
> I do all my development on windows, for unix "con" should be replaced on
> "/dev/stdin". You can hardcode this :) or just add a little code snippet
> to make this target platform independent (I didn't test it on unix, so
> probably you have to test it a little bit):
> 
> 	//get os name
> 	var os = project.getProperty("os.name");
> 	var console;
> 
> 	//select appropriate input
> 	if(os.charAt(0) == 'W' || os.charAt(0) == 'w'){
> 		console = "con";
> 	}else{
> 		console = "/dev/stdin";
> 	}
> 
> 	//get standart input stream
> 	var stdin = new BufferedReader(new InputStreamReader(new
> FileInputStream(console)));
> 
> Just add this code to the target and remove duplicate line where new
> BufferedReader is created.

If you're running Ant 1.4, you can use the <condition> task to set a *nix
versus Win* property -- eg:

  <condition property="console" value="/dev/stdin">
    <os family="unix"/>
  </condition>
  <condition property="console" value="con">
    <os family="windows"/>
  </condition>

Diane


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message