ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: Patch for Execute task on Mac OS X
Date Wed, 11 Apr 2001 22:47:58 GMT
Applied - Thanks !

At 03:40  11/4/01 +0000, Archit Shah wrote:
>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;
>
>
Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Mime
View raw message