Browse Source

Add a "relative" attribute to <apply> - this allows users to pass

relative paths on the command line instead of absolute.

Submitted by:	Matthew O'Haire <mohaire@trysoft.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269982 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
45660d1b2d
3 changed files with 26 additions and 2 deletions
  1. +3
    -0
      WHATSNEW
  2. +8
    -0
      docs/manual/CoreTasks/apply.html
  3. +15
    -2
      src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java

+ 3
- 0
WHATSNEW View File

@@ -79,6 +79,9 @@ Other changes:

* Added an optional encoding attribute to <fixcrlf>

* <apply> 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
===========================================



+ 8
- 0
docs/manual/CoreTasks/apply.html View File

@@ -49,6 +49,14 @@ one mapper.</p>
<td valign="top">the directory in which the command should be executed.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">relative</td>
<td valign="top">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).</td>
<td align="center" valign="top">No, default is <i>false</i></td>
</tr>
<tr>
<td valign="top">os</td>
<td valign="top">list of Operating Systems on which the command may be


+ 15
- 2
src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -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;
}


Loading…
Cancel
Save