From 45660d1b2d543689a2f6fbdc2f794263e7e7b85d Mon Sep 17 00:00:00 2001
From: Stefan Bodewig
Date: Wed, 21 Nov 2001 17:20:29 +0000
Subject: [PATCH] Add a "relative" attribute to - this allows users to
pass relative paths on the command line instead of absolute.
Submitted by: Matthew O'Haire
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269982 13f79535-47bb-0310-9956-ffa450edef68
---
WHATSNEW | 3 +++
docs/manual/CoreTasks/apply.html | 8 ++++++++
.../apache/tools/ant/taskdefs/ExecuteOn.java | 17 +++++++++++++++--
3 files changed, 26 insertions(+), 2 deletions(-)
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;
}
|