Browse Source

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.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272359 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
4a8cd1490b
1 changed files with 18 additions and 1 deletions
  1. +18
    -1
      src/main/org/apache/tools/ant/taskdefs/Chmod.java

+ 18
- 1
src/main/org/apache/tools/ant/taskdefs/Chmod.java View File

@@ -58,6 +58,7 @@ import java.io.File;
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 @@ public class Chmod extends ExecuteOn {
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 class Chmod extends ExecuteOn {
}

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


Loading…
Cancel
Save