ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition Os.java
Date Tue, 29 Jan 2002 17:22:56 GMT
bodewig     02/01/29 09:22:56

  Modified:    docs/manual/CoreTasks conditions.html
               src/main/org/apache/tools/ant/taskdefs Execute.java
               src/main/org/apache/tools/ant/taskdefs/condition Os.java
  Log:
  Add a new "os family" win9x.  If I had a decent name for Windows that
  is NT or 2000 or XP I would have added a family as well 8-)
  
  Take advantage of that new family in Execute.
  
  Revision  Changes    Path
  1.5       +1 -0      jakarta-ant/docs/manual/CoreTasks/conditions.html
  
  Index: conditions.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/conditions.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- conditions.html	14 Jan 2002 00:06:07 -0000	1.4
  +++ conditions.html	29 Jan 2002 17:22:56 -0000	1.5
  @@ -92,6 +92,7 @@
     <li>unix (for all Unix and Unix-like operating systems)</li>
     <li>netware (for Novell NetWare)</li>
     <li>os/2 (for OS/2)</li>
  +  <li>win9x for Microsoft Windows 95 and 98</li>
   </ul>
   
   <h4>equals</h4>
  
  
  
  1.31      +3 -11     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
  
  Index: Execute.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Execute.java	29 Jan 2002 16:55:11 -0000	1.30
  +++ Execute.java	29 Jan 2002 17:22:56 -0000	1.31
  @@ -77,7 +77,7 @@
    *
    * @author thomas.haas@softwired-inc.com
    *
  - * @version $Revision: 1.30 $
  + * @version $Revision: 1.31 $
    */
   public class Execute {
   
  @@ -137,13 +137,7 @@
                   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 @@
               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;
  
  
  
  1.12      +12 -4     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition/Os.java
  
  Index: Os.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition/Os.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Os.java	25 Jan 2002 16:15:44 -0000	1.11
  +++ Os.java	29 Jan 2002 17:22:56 -0000	1.12
  @@ -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
  @@ -63,7 +63,7 @@
    *
    * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
    * @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a>
  - * @version $Revision: 1.11 $
  + * @version $Revision: 1.12 $
    */
   public class Os implements Condition {
       private final static String osName =
  @@ -90,12 +90,15 @@
        *
        * @param f      The OS family type desired<br />
        *               Possible values:<br />
  -     *               <ul><li>dos</li>
  +     *               <ul>
  +     *               <li>dos</li>
        *               <li>mac</li>
        *               <li>netware</li>
        *               <li>os/2</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);}
   
  @@ -212,6 +215,11 @@
                   } 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 \""
  
  
  

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


Mime
View raw message