is NT or 2000 or XP I would have added a family as well 8-) Take advantage of that new family in Execute. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271005 13f79535-47bb-0310-9956-ffa450edef68master
@@ -92,6 +92,7 @@ the tests succeed. | |||||
<li>unix (for all Unix and Unix-like operating systems)</li> | <li>unix (for all Unix and Unix-like operating systems)</li> | ||||
<li>netware (for Novell NetWare)</li> | <li>netware (for Novell NetWare)</li> | ||||
<li>os/2 (for OS/2)</li> | <li>os/2 (for OS/2)</li> | ||||
<li>win9x for Microsoft Windows 95 and 98</li> | |||||
</ul> | </ul> | ||||
<h4>equals</h4> | <h4>equals</h4> | ||||
@@ -137,13 +137,7 @@ public class Execute { | |||||
baseLauncher = new CommandLauncher(); | baseLauncher = new CommandLauncher(); | ||||
} | } | ||||
// Determine if we're running under XP/2000/NT or 98/95 | |||||
String osname = | |||||
System.getProperty("os.name").toLowerCase(Locale.US); | |||||
if ( osname.indexOf("nt") >= 0 || | |||||
osname.indexOf("2000") >= 0 || | |||||
osname.indexOf("xp") >= 0 ) { | |||||
if ( !Os.isFamily("win9x") ) { | |||||
// Windows XP/2000/NT | // Windows XP/2000/NT | ||||
shellLauncher = new WinNTCommandLauncher(baseLauncher); | shellLauncher = new WinNTCommandLauncher(baseLauncher); | ||||
} | } | ||||
@@ -236,9 +230,7 @@ public class Execute { | |||||
String osname = | String osname = | ||||
System.getProperty("os.name").toLowerCase(Locale.US); | System.getProperty("os.name").toLowerCase(Locale.US); | ||||
// Determine if we're running under XP/2000/NT or 98/95 | // Determine if we're running under XP/2000/NT or 98/95 | ||||
if ( osname.indexOf("nt") >= 0 || | |||||
osname.indexOf("2000") >= 0 || | |||||
osname.indexOf("xp") >= 0 ) { | |||||
if ( !Os.isFamily("win9x") ) { | |||||
// Windows XP/2000/NT | // Windows XP/2000/NT | ||||
String[] cmd = {"cmd", "/c", "set" }; | String[] cmd = {"cmd", "/c", "set" }; | ||||
return cmd; | return cmd; | ||||
@@ -1,7 +1,7 @@ | |||||
/* | /* | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* | * | ||||
* Copyright (c) 2001 The Apache Software Foundation. All rights | |||||
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights | |||||
* reserved. | * reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
@@ -90,12 +90,15 @@ public class Os implements Condition { | |||||
* | * | ||||
* @param f The OS family type desired<br /> | * @param f The OS family type desired<br /> | ||||
* Possible values:<br /> | * Possible values:<br /> | ||||
* <ul><li>dos</li> | |||||
* <ul> | |||||
* <li>dos</li> | |||||
* <li>mac</li> | * <li>mac</li> | ||||
* <li>netware</li> | * <li>netware</li> | ||||
* <li>os/2</li> | * <li>os/2</li> | ||||
* <li>unix</li> | * <li>unix</li> | ||||
* <li>windows</li></ul> | |||||
* <li>windows</li> | |||||
* <li>win9x</li> | |||||
* </ul> | |||||
*/ | */ | ||||
public void setFamily(String f) {family = f.toLowerCase(Locale.US);} | public void setFamily(String f) {family = f.toLowerCase(Locale.US);} | ||||
@@ -212,6 +215,11 @@ public class Os implements Condition { | |||||
} else if (family.equals("unix")) { | } else if (family.equals("unix")) { | ||||
isFamily = pathSep.equals(":") | isFamily = pathSep.equals(":") | ||||
&& (!isFamily("mac") || osName.endsWith("x")); | && (!isFamily("mac") || osName.endsWith("x")); | ||||
} else if (family.equals("win9x")) { | |||||
isFamily = isFamily("windows") && | |||||
!(osName.indexOf("nt") >= 0 || | |||||
osName.indexOf("2000") >= 0 || | |||||
osName.indexOf("xp") >= 0 ); | |||||
} else { | } else { | ||||
throw new BuildException( | throw new BuildException( | ||||
"Don\'t know how to detect os family \"" | "Don\'t know how to detect os family \"" | ||||