diff --git a/WHATSNEW b/WHATSNEW
index 4a1022773..a7685f1db 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -72,6 +72,8 @@ Other changes:
* Docs fixes for xmlvalidate.html. Bugzilla Report 27092.
+* now accepts nested s. Bugzilla Report 26364.
+
Changes from Ant 1.6.0 to Ant 1.6.1
=============================================
diff --git a/docs/manual/CoreTasks/pathconvert.html b/docs/manual/CoreTasks/pathconvert.html
index e2e4f688e..ad67233d0 100644
--- a/docs/manual/CoreTasks/pathconvert.html
+++ b/docs/manual/CoreTasks/pathconvert.html
@@ -19,6 +19,9 @@ of files in a FileList into a path.
Nested <map>
elements can be specified to map Windows
drive letters to Unix paths, and vice-versa.
+More complex transformations can be achieved using a nested
+<mapper>
.
+
Parameters
@@ -114,6 +117,11 @@ prefixes of other from
values.
If the refid
attribute is not specified, then a
nested <path>
element must be supplied. See
Path-like Structures for details.
+mapper
+A single nested
+<mapper>
element can be specified
+to perform any of various filename transformations.
+
Examples
In the examples below, assume that the ${wl.home}
property
diff --git a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
index 137f0eee7..46e0fb85f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
+++ b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
@@ -19,6 +19,8 @@ package org.apache.tools.ant.taskdefs;
import java.io.File;
import java.util.StringTokenizer;
import java.util.Vector;
+import java.util.List;
+import java.util.ArrayList;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
@@ -29,6 +31,8 @@ import org.apache.tools.ant.types.FileList;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
+import org.apache.tools.ant.types.Mapper;
+import org.apache.tools.ant.util.FileNameMapper;
/**
* Converts path and classpath information to a specific target OS
@@ -83,6 +87,9 @@ public class PathConvert extends Task {
*/
private String dirSep = null;
+ /** Filename mapper */
+ private Mapper mapper = null;
+
/**
* constructor
*/
@@ -352,6 +359,18 @@ public class PathConvert extends Task {
// Get the list of path components in canonical form
String[] elems = path.list();
+ if (mapper != null) {
+ FileNameMapper impl = mapper.getImplementation();
+ List ret = new ArrayList();
+ for (int i = 0; i < elems.length; ++i) {
+ String[] mapped = impl.mapFileName(elems[i]);
+ for (int m = 0; mapped != null && m < mapped.length; ++m) {
+ ret.add(mapped[m]);
+ }
+ }
+ elems = (String[]) ret.toArray(new String[] {});
+ }
+
for (int i = 0; i < elems.length; i++) {
String elem = elems[i];
@@ -435,6 +454,18 @@ public class PathConvert extends Task {
return elem;
}
+ /**
+ * Add a mapper to convert the file names.
+ *
+ * @param mapper a Mapper
value
+ */
+ public void addMapper(Mapper mapper) {
+ if (this.mapper != null) {
+ throw new BuildException(
+ "Cannot define more than one mapper");
+ }
+ this.mapper = mapper;
+ }
/**
* Validate that all our parameters have been properly initialized.