diff --git a/WHATSNEW b/WHATSNEW index 2dcc80615..41f4d4471 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -48,6 +48,9 @@ Fixed bugs: * junit4 did not work with fork=no and junit4 in $ANT_HOME/lib. Bugzilla report 40697. +* PathConvert on Windows should process forward and back slashes equivalently. + Bugzilla report 32884. + Other changes: -------------- diff --git a/docs/manual/CoreTasks/pathconvert.html b/docs/manual/CoreTasks/pathconvert.html index 18c1aba3d..080190280 100644 --- a/docs/manual/CoreTasks/pathconvert.html +++ b/docs/manual/CoreTasks/pathconvert.html @@ -107,9 +107,13 @@ drive letters to Unix paths, and vice-versa.

from - The prefix to match. Note that this value is case-insensitive when - the build is running on a Windows platform and case-sensitive when running on a - Unix platform. + + The prefix to match. Note that this value is case-insensitive when + the build is running on a Windows platform and case-sensitive + when running on a Unix platform. + Since Ant 1.7.0, on Windows this value is also insensitive + to the slash style used for directories, one can use '/' or '\'. + Yes @@ -197,8 +201,17 @@ it defaults to the appropriate character for the current platform. Such a list then be used in another task, like javadoc, that requires a comma separated list of files.

- - +

Example 4

+
+    <pathconvert property="prop" dirsep="|">
+      <map from="${basedir}/abc/" to=''/>
+      <path location="abc/def/ghi"/>
+    </pathconvert>
+
+

+ This example sets the property "prop" to "def|ghi" on + Windows and on Unix. +

diff --git a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java index 52a37adfa..a3cfb9b48 100644 --- a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java +++ b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java @@ -139,8 +139,11 @@ public class PathConvert extends Task { + "in a map entry"); } // If we're on windows, then do the comparison ignoring case - String cmpElem = onWindows ? elem.toLowerCase() : elem; - String cmpFrom = onWindows ? from.toLowerCase() : from; + // and treat the two directory characters the same + String cmpElem = + onWindows ? elem.toLowerCase().replace('\\', '/') : elem; + String cmpFrom = + onWindows ? from.toLowerCase().replace('\\', '/') : from; // If the element starts with the configured prefix, then // convert the prefix to the configured 'to' value. diff --git a/src/tests/antunit/taskdefs/pathconvert-test.xml b/src/tests/antunit/taskdefs/pathconvert-test.xml index 2e0052456..b5c43743e 100644 --- a/src/tests/antunit/taskdefs/pathconvert-test.xml +++ b/src/tests/antunit/taskdefs/pathconvert-test.xml @@ -3,7 +3,7 @@ - +