bodewig     01/10/31 03:02:23

  Modified:    docs/manual/CoreTasks condition.html
               src/main/org/apache/tools/ant/taskdefs/condition Os.java
  Log:
  Add OS/2 as Os family
  
  Revision  Changes    Path
  1.5       +2 -1      jakarta-ant/docs/manual/CoreTasks/condition.html
  
  Index: condition.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/condition.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- condition.html    2001/10/30 10:05:34     1.4
  +++ condition.html    2001/10/31 11:02:22     1.5
  @@ -99,7 +99,8 @@
       Microsoft Windows and OS/2)</li>
     <li>mac (for all Apple Macintosh systems)</li>
     <li>unix (for all Unix and Unix-like operating systems)</li>
  -  <li>netware</li>
  +  <li>netware (for Novell Netware)</li>
  +  <li>os/2 (for OS/2)</li>
   </ul>
   
   <h4>equals</h4>
  
  
  
  1.4       +14 -3     
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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Os.java   2001/10/17 09:33:23     1.3
  +++ Os.java   2001/10/31 11:02:23     1.4
  @@ -56,15 +56,23 @@
   
   import org.apache.tools.ant.BuildException;
   
  +import java.util.Locale;
  +
   /**
    * Condition that tests the OS type.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]>Stefan Bodewig</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class Os implements Condition {
       private String family;
   
  +    public Os() {}
  +
  +    public Os(String family) {
  +        setFamily(family);
  +    }
  +
       /**
        * Sets the desired OS family type
        * 
  @@ -73,10 +81,11 @@
        *               <ul><li>dos</li>
        *               <li>mac</li>
        *               <li>netware</li>
  +     *               <li>os/2</li>
        *               <li>unix</li>
        *               <li>windows</li></ul>
        */
  -    public void setFamily(String f) {family = f.toLowerCase();}
  +    public void setFamily(String f) {family = f.toLowerCase(Locale.US);}
   
       /**
        * Determines if the OS on which Ant is executing matches the type of 
  @@ -84,11 +93,13 @@
        * @see Os#setFamily(String)
        */
       public boolean eval() throws BuildException {
  -        String osName = System.getProperty("os.name").toLowerCase();
  +        String osName = System.getProperty("os.name").toLowerCase(Locale.US);
           String pathSep = System.getProperty("path.separator");
           if (family != null) {
               if (family.equals("windows")) {
                   return osName.indexOf("windows") > -1;
  +            } else if (family.equals("os/2")) {
  +                return osName.indexOf("os/2") > -1;
               } else if (family.equals("netware")) {
                   return osName.indexOf("netware") > -1;
               } else if (family.equals("dos")) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to