diff --git a/docs/manual/CoreTasks/conditions.html b/docs/manual/CoreTasks/conditions.html index 86f02d9e9..577d689d7 100644 --- a/docs/manual/CoreTasks/conditions.html +++ b/docs/manual/CoreTasks/conditions.html @@ -92,6 +92,7 @@ the tests succeed.
  • unix (for all Unix and Unix-like operating systems)
  • netware (for Novell NetWare)
  • os/2 (for OS/2)
  • +
  • win9x for Microsoft Windows 95 and 98
  • equals

    diff --git a/src/main/org/apache/tools/ant/taskdefs/Execute.java b/src/main/org/apache/tools/ant/taskdefs/Execute.java index 6ffc65a7f..cec69bab3 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Execute.java +++ b/src/main/org/apache/tools/ant/taskdefs/Execute.java @@ -137,13 +137,7 @@ public class Execute { 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 shellLauncher = new WinNTCommandLauncher(baseLauncher); } @@ -236,9 +230,7 @@ public class Execute { String osname = System.getProperty("os.name").toLowerCase(Locale.US); // 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 String[] cmd = {"cmd", "/c", "set" }; return cmd; diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java index ec8b1fc6a..1d8a8cb89 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java @@ -1,7 +1,7 @@ /* * 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. * * 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
    * Possible values:
    - * */ public void setFamily(String f) {family = f.toLowerCase(Locale.US);} @@ -212,6 +215,11 @@ public class Os implements Condition { } else if (family.equals("unix")) { isFamily = pathSep.equals(":") && (!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 { throw new BuildException( "Don\'t know how to detect os family \""