ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Archit Shah <as...@arsdigita.com>
Subject Patch for Execute task on Mac OS X
Date Wed, 11 Apr 2001 15:40:16 GMT
Currently, ant does not fetch the environment from Mac OS. There is a
TODO comment in org.apache.tools.ant.taskdefs.Execute

This patch lets ant grab the environment from OS X machines using the
unix standard /usr/bin/env. It does not alter the behavior for OS 9
and previous Macs. It requires ant to have the "read" PropertyPermission
on "os.version" in addition to "os.name"

 -- Archit

--- src/main/org/apache/tools/ant/taskdefs/Execute.old Tue Apr 10 15:53:07 2001
+++ src/main/org/apache/tools/ant/taskdefs/Execute.java Tue Apr 10 15:42:03 2001
@@ -179,6 +179,18 @@
         String osname = System.getProperty("os.name").toLowerCase();
         if ( osname.indexOf("mac os") >= 0 ) {
             // Mac
+            // Determine if we are running under OS X
+            try {
+                float version = Float.parseFloat(System.getProperty("os.version"));
+                if (version >= 10.0) {
+                    // OS X - just line UNIX
+                    String[] cmd = {"/usr/bin/env"};
+                    return cmd;
+                }
+            } catch (NumberFormatException e) {
+                // fall through to OS 9
+            }
+            // OS 9 and previous
             // TODO: I have no idea how to get it, someone must fix it
             String[] cmd = null;
             return cmd;


Mime
View raw message