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 Chmod.java
Date Thu, 11 Apr 2002 07:03:11 GMT
bodewig     02/04/11 00:03:11

  Modified:    src/main/org/apache/tools/ant/taskdefs Chmod.java
  Log:
  Make sure the implicit fileset in <chmod> knows the current project.
  Don't remove things that have never been added.
  Share secret knowledge of wise old (wo)men.
  
  Revision  Changes    Path
  1.23      +18 -1     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Chmod.java
  
  Index: Chmod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Chmod.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Chmod.java	10 Apr 2002 14:42:42 -0000	1.22
  +++ Chmod.java	11 Apr 2002 07:03:11 -0000	1.23
  @@ -58,6 +58,7 @@
   import java.io.IOException;
   
   import org.apache.tools.ant.BuildException;
  +import org.apache.tools.ant.Project;
   import org.apache.tools.ant.taskdefs.condition.Os;
   import org.apache.tools.ant.types.Commandline;
   import org.apache.tools.ant.types.FileSet;
  @@ -84,6 +85,14 @@
           super.setSkipEmptyFilesets(true);
       }
   
  +    /**
  +     * @see ProjectComponent#setProject
  +     */
  +    public void setProject(Project project) {
  +        super.setProject(project);
  +        defaultSet.setProject(project);
  +    }
  +
       public void setFile(File src) {
           FileSet fs = new FileSet();
           fs.setDir(new File(src.getParent()));
  @@ -171,11 +180,19 @@
       }
   
       public void execute() throws BuildException {
  +        /*
  +         * In Ant 1.1, <chmod dir="foo" /> means, change the permissions
  +         * of directory foo, not anything inside of it.  This is the case the
  +         * second branch of the if statement below catches for backwards
  +         * compatibility.
  +         */
           if (defaultSetDefined || defaultSet.getDir(project) == null) {
               try {
                   super.execute();
               } finally {
  -                filesets.removeElement(defaultSet);
  +                if (defaultSetDefined && defaultSet.getDir(project) != null) {
  +                    filesets.removeElement(defaultSet);
  +                }
               }
           } else if (isValidOs()) {
               // we are chmodding the given directory
  
  
  

--
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