Bugzilla report 32884. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@454032 13f79535-47bb-0310-9956-ffa450edef68master
@@ -48,6 +48,9 @@ Fixed bugs: | |||||
* junit4 did not work with fork=no and junit4 in $ANT_HOME/lib. | * junit4 did not work with fork=no and junit4 in $ANT_HOME/lib. | ||||
Bugzilla report 40697. | Bugzilla report 40697. | ||||
* PathConvert on Windows should process forward and back slashes equivalently. | |||||
Bugzilla report 32884. | |||||
Other changes: | Other changes: | ||||
-------------- | -------------- | ||||
@@ -107,9 +107,13 @@ drive letters to Unix paths, and vice-versa.</p> | |||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td valign="top">from</td> | <td valign="top">from</td> | ||||
<td valign="top">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.</td> | |||||
<td valign="top"> | |||||
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. | |||||
<em>Since Ant 1.7.0</em>, on Windows this value is also insensitive | |||||
to the slash style used for directories, one can use '/' or '\'. | |||||
</td> | |||||
<td valign="top" align="center">Yes</td> | <td valign="top" align="center">Yes</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
@@ -197,8 +201,17 @@ it defaults to the appropriate character for the current platform. Such a list | |||||
then be used in another task, like <tt>javadoc</tt>, that requires a comma separated | then be used in another task, like <tt>javadoc</tt>, that requires a comma separated | ||||
list of files. | list of files. | ||||
</p> | </p> | ||||
<h4>Example 4</h4> | |||||
<pre> | |||||
<pathconvert property="prop" dirsep="|"> | |||||
<map from="${basedir}/abc/" to=''/> | |||||
<path location="abc/def/ghi"/> | |||||
</pathconvert> | |||||
</pre> | |||||
<p> | |||||
This example sets the property "prop" to "def|ghi" on | |||||
Windows and on Unix. | |||||
</p> | |||||
</body> | </body> | ||||
</html> | </html> | ||||
@@ -139,8 +139,11 @@ public class PathConvert extends Task { | |||||
+ "in a map entry"); | + "in a map entry"); | ||||
} | } | ||||
// If we're on windows, then do the comparison ignoring case | // 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 | // If the element starts with the configured prefix, then | ||||
// convert the prefix to the configured 'to' value. | // convert the prefix to the configured 'to' value. | ||||
@@ -3,7 +3,7 @@ | |||||
<target name="test-dir-char"> | <target name="test-dir-char"> | ||||
<pathconvert property="def|ghi" dirsep="|"> | <pathconvert property="def|ghi" dirsep="|"> | ||||
<map from="${basedir}/abc/" to=''/> | <map from="${basedir}/abc/" to=''/> | ||||
<path path="${basedir}/abc/def/ghi"/> | |||||
<path location="abc/def/ghi"/> | |||||
</pathconvert> | </pathconvert> | ||||
<au:assertTrue> | <au:assertTrue> | ||||
<equals arg1="${def|ghi}" arg2="def|ghi"/> | <equals arg1="${def|ghi}" arg2="def|ghi"/> | ||||