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-ffa450edef68master
@@ -79,6 +79,9 @@ Other changes: | |||||
* Added an optional encoding attribute to <fixcrlf> | * 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 | Changes from Ant 1.4 to Ant 1.4.1 | ||||
=========================================== | =========================================== | ||||
@@ -49,6 +49,14 @@ one mapper.</p> | |||||
<td valign="top">the directory in which the command should be executed.</td> | <td valign="top">the directory in which the command should be executed.</td> | ||||
<td align="center" valign="top">No</td> | <td align="center" valign="top">No</td> | ||||
</tr> | </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> | <tr> | ||||
<td valign="top">os</td> | <td valign="top">os</td> | ||||
<td valign="top">list of Operating Systems on which the command may be | <td valign="top">list of Operating Systems on which the command may be | ||||
@@ -78,6 +78,7 @@ import java.io.IOException; | |||||
public class ExecuteOn extends ExecTask { | public class ExecuteOn extends ExecTask { | ||||
protected Vector filesets = new Vector(); | protected Vector filesets = new Vector(); | ||||
private boolean relative = false; | |||||
private boolean parallel = false; | private boolean parallel = false; | ||||
protected String type = "file"; | protected String type = "file"; | ||||
protected Commandline.Marker srcFilePos = null; | protected Commandline.Marker srcFilePos = null; | ||||
@@ -99,6 +100,14 @@ public class ExecuteOn extends ExecTask { | |||||
filesets.addElement(set); | 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? | * Shall the command work on all specified files in parallel? | ||||
*/ | */ | ||||
@@ -348,8 +357,12 @@ public class ExecuteOn extends ExecTask { | |||||
// fill in source file names | // fill in source file names | ||||
for (int i=0; i < srcFiles.length; i++) { | 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; | return result; | ||||
} | } | ||||