diff --git a/WHATSNEW b/WHATSNEW index 07cd8ee0d..5b290788b 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -79,6 +79,9 @@ Other changes: * Added an optional encoding attribute to +* has a new attribute relative that allows users to pass the + filenames as relative instead of absolute paths on the command line. + Changes from Ant 1.4 to Ant 1.4.1 =========================================== diff --git a/docs/manual/CoreTasks/apply.html b/docs/manual/CoreTasks/apply.html index 1ecd7b7ba..60675663a 100644 --- a/docs/manual/CoreTasks/apply.html +++ b/docs/manual/CoreTasks/apply.html @@ -49,6 +49,14 @@ one mapper.

the directory in which the command should be executed. No + + relative + whether the filenames should be passed on the + command line as absolute or relative pathnames (relative to the + base directory of the corresponding fileset for source files or + the dest attribute for target files). + No, default is false + os list of Operating Systems on which the command may be diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java index e10579327..5c65c34ad 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -78,6 +78,7 @@ import java.io.IOException; public class ExecuteOn extends ExecTask { protected Vector filesets = new Vector(); + private boolean relative = false; private boolean parallel = false; protected String type = "file"; protected Commandline.Marker srcFilePos = null; @@ -99,6 +100,14 @@ public class ExecuteOn extends ExecTask { filesets.addElement(set); } + /** + * Should filenames be returned as relative path names? + */ + public void setRelative(boolean relative) { + this.relative = relative; + } + + /** * Shall the command work on all specified files in parallel? */ @@ -348,8 +357,12 @@ public class ExecuteOn extends ExecTask { // fill in source file names for (int i=0; i < srcFiles.length; i++) { - result[srcIndex+i] = - (new File(baseDirs[i], srcFiles[i])).getAbsolutePath(); + if (!relative) { + result[srcIndex+i] = + (new File(baseDirs[i], srcFiles[i])).getAbsolutePath(); + } else { + result[srcIndex+i] = srcFiles[i]; + } } return result; }