Browse Source

Pathconvert no longer requires that one of (targetos|pathsep|dirsep)

be set; platform defaults are used when this is the case.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277715 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 20 years ago
parent
commit
595133b251
5 changed files with 17 additions and 15 deletions
  1. +3
    -0
      WHATSNEW
  2. +3
    -6
      docs/manual/CoreTasks/pathconvert.html
  3. +4
    -0
      src/etc/testcases/taskdefs/pathconvert.xml
  4. +2
    -8
      src/main/org/apache/tools/ant/taskdefs/PathConvert.java
  5. +5
    -1
      src/testcases/org/apache/tools/ant/taskdefs/PathConvertTest.java

+ 3
- 0
WHATSNEW View File

@@ -220,6 +220,9 @@ Other changes:
* Recursive token expansion in a filterset can now be disabled by * Recursive token expansion in a filterset can now be disabled by
setting its recurse attribute to false. setting its recurse attribute to false.


* Pathconvert no longer requires that one of (targetos|pathsep|dirsep)
be set; platform defaults are used when this is the case.

Fixed bugs: Fixed bugs:
----------- -----------




+ 3
- 6
docs/manual/CoreTasks/pathconvert.html View File

@@ -7,7 +7,7 @@


<body> <body>


<h2><a name="foreach">Pathconvert</a></h2>
<h2><a name="pathconvert">Pathconvert</a></h2>
<h3>Description</h3> <h3>Description</h3>
<p>Converts a nested <code>&lt;path&gt;</code> or reference to a Path, <p>Converts a nested <code>&lt;path&gt;</code> or reference to a Path,
FileSet, DirSet, or FileList into a path FileSet, DirSet, or FileList into a path
@@ -40,10 +40,7 @@ drive letters to Unix paths, and vice-versa.</p>
<code>pathsep</code> and <code>dirsep</code> <code>pathsep</code> and <code>dirsep</code>
according to the specified target architecture. according to the specified target architecture.
</td> </td>
<td valign="top" align="center">
Yes, unless <code>pathsep</code> and/or
<code>dirsep</code> are specified.
</td>
<td valign="top" align="center">No</td>
</tr> </tr>
<tr> <tr>
<td valign="top">dirsep</td> <td valign="top">dirsep</td>
@@ -185,7 +182,7 @@ list of files.
</p> </p>


<hr> <hr>
<p align="center">Copyright &copy; 2001-2004 The Apache Software Foundation.
<p align="center">Copyright &copy; 2001-2005 The Apache Software Foundation.
All rights Reserved.</p> All rights Reserved.</p>
</body> </body>
</html> </html>


+ 4
- 0
src/etc/testcases/taskdefs/pathconvert.xml View File

@@ -18,4 +18,8 @@
</pathconvert> </pathconvert>
</target> </target>


<target name="testnotargetos">
<pathconvert property="result" refid="testpath" />
</target>

</project> </project>

+ 2
- 8
src/main/org/apache/tools/ant/taskdefs/PathConvert.java View File

@@ -190,7 +190,7 @@ public class PathConvert extends Task {
/** /**
* Set targetos to a platform to one of * Set targetos to a platform to one of
* "windows", "unix", "netware", or "os/2"; * "windows", "unix", "netware", or "os/2";
* defaults to the current platform.
* current platform settings are used by default.
* @deprecated use the method taking a TargetOs argument instead. * @deprecated use the method taking a TargetOs argument instead.
* @see #setTargetos(PathConvert.TargetOs) * @see #setTargetos(PathConvert.TargetOs)
*/ */
@@ -203,7 +203,7 @@ public class PathConvert extends Task {
/** /**
* Set targetos to a platform to one of * Set targetos to a platform to one of
* "windows", "unix", "netware", or "os/2"; * "windows", "unix", "netware", or "os/2";
* defaults to the current platform.
* current platform settings are used by default.
* @param target the target os * @param target the target os
* *
* @since Ant 1.5 * @since Ant 1.5
@@ -437,12 +437,6 @@ public class PathConvert extends Task {
if (property == null) { if (property == null) {
throw new BuildException("You must specify a property"); throw new BuildException("You must specify a property");
} }
// Must either have a target OS or both a dirSep and pathSep

if (targetOS == null && pathSep == null && dirSep == null) {
throw new BuildException("You must specify at least one of "
+ "targetOS, dirSep, or pathSep");
}
// Determine the separator strings. The dirsep and pathsep attributes // Determine the separator strings. The dirsep and pathsep attributes
// override the targetOS settings. // override the targetOS settings.
String dsep = File.separator; String dsep = File.separator;


+ 5
- 1
src/testcases/org/apache/tools/ant/taskdefs/PathConvertTest.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2004 The Apache Software Foundation.
* Copyright 2004-2005 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -43,6 +43,10 @@ public class PathConvertTest extends BuildFileTest {
test("testmapper"); test("testmapper");
} }


public void testNoTargetOs() {
executeTarget("testnotargetos");
}

private void test(String target) { private void test(String target) {
executeTarget(target); executeTarget(target);
assertPropertyEquals("result", "test#" + BUILD_FILENAME); assertPropertyEquals("result", "test#" + BUILD_FILENAME);


Loading…
Cancel
Save