ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs ExecTask.java
Date Fri, 20 Aug 2004 10:56:52 GMT
bodewig     2004/08/20 03:56:52

  Modified:    src/main/org/apache/tools/ant/taskdefs ExecTask.java
  Log:
  When searching /usr/local/java/jdk1.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/bodewig/bin:/home/bodewig/dev/xml-forrest/build/dist/shbat//bin,
look into user supplied environment first
  
  Revision  Changes    Path
  1.71      +19 -2     ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
  
  Index: ExecTask.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- ExecTask.java	23 Apr 2004 07:33:51 -0000	1.70
  +++ ExecTask.java	20 Aug 2004 10:56:52 -0000	1.71
  @@ -391,16 +391,29 @@
   
           // couldn't find it - must be on path
           if (searchPath) {
  +            Path p = null;
  +            String[] environment = env.getVariables();
  +            if (environment != null) {
  +                for (int i = 0; i < environment.length; i++) {
  +                    if (isPath(environment[i])) {
  +                        p = new Path(getProject(), 
  +                                     environment[i].substring(5));
  +                        break;
  +                    }
  +                }
  +            }
  +
  +            if (p == null) {
               Vector env = Execute.getProcEnvironment();
               Enumeration e = env.elements();
  -            Path p = null;
               while (e.hasMoreElements()) {
                   String line = (String) e.nextElement();
  -                if (line.startsWith("PATH=") || line.startsWith("Path=")) {
  +                if (isPath(line)) {
                       p = new Path(getProject(), line.substring(5));
                       break;
                   }
               }
  +            }
   
               if (p != null) {
                   String[] dirs = p.list();
  @@ -645,6 +658,10 @@
        * Flush the output stream - if there is one.
        */
       protected void logFlush() {
  +    }
  +
  +    private boolean isPath(String line) {
  +        return line.startsWith("PATH=") || line.startsWith("Path=");
       }
   
   }
  
  
  

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


Mime
View raw message