Browse Source

change name of handledirchar to handledirsep to be similar to pathconvet

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278063 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 20 years ago
parent
commit
41985851e2
8 changed files with 23 additions and 23 deletions
  1. +1
    -1
      WHATSNEW
  2. +4
    -4
      docs/manual/CoreTypes/mapper.html
  3. +2
    -2
      src/etc/testcases/types/mappers/globmapper.xml
  4. +2
    -2
      src/etc/testcases/types/mappers/regexpmapper.xml
  5. +5
    -5
      src/main/org/apache/tools/ant/util/GlobPatternMapper.java
  6. +5
    -5
      src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
  7. +2
    -2
      src/testcases/org/apache/tools/ant/types/mappers/GlobMapperTest.java
  8. +2
    -2
      src/testcases/org/apache/tools/ant/types/mappers/RegexpPatternMapperTest.java

+ 1
- 1
WHATSNEW View File

@@ -214,7 +214,7 @@ Other changes:
* added casesensitive attribute to <globmapper> and <regexpmapper>
Bugzilla report 16686

* added handledirchar attribute to <globmapper> and <regexpmapper>
* added handledirsep attribute to <globmapper> and <regexpmapper>
Bugzilla report 32487

* added a new mapper <filtermapper>


+ 4
- 4
docs/manual/CoreTypes/mapper.html View File

@@ -70,7 +70,7 @@ directory separator of your current platform. If you need to specify
this separator, use <code>${file.separator}</code> instead.
For the regexpmapper, <code>${file.separator}</code> will not work,
as on windows it is the '\' character, and this is an escape character
for regular expressions, one should use the <code>handledirchar</code> attribute
for regular expressions, one should use the <code>handledirsep</code> attribute
instead.
</p>
<h3>Parameters specified as nested elements</h3>
@@ -264,7 +264,7 @@ that don't match the <code>from</code> pattern will be ignored.</p>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">handledirchar</td>
<td valign="top">handledirsep</td>
<td valign="top">
If this is specified, the mapper will ignore the difference between the normal
directory separator characters - \ and /.
@@ -479,7 +479,7 @@ jakarta-ORO and finally try jakarta-regexp.</li>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">handledirchar</td>
<td valign="top">handledirsep</td>
<td valign="top">
If this is specified, the mapper will treat a \ character in a filename
as a / for the purposes of matching.
@@ -512,7 +512,7 @@ jakarta-ORO and finally try jakarta-regexp.</li>
&lt;pathconvert property="hd.prop" targetos="windows"&gt;
&lt;path path="d\e/f\j.java"/&gt;
&lt;chainedmapper&gt;
&lt;regexpmapper from="${basedir}/d/e/(.*)" to="\1" handledirchar="yes"/&gt;
&lt;regexpmapper from="${basedir}/d/e/(.*)" to="\1" handledirsep="yes"/&gt;
&lt;/chainedmapper&gt;
&lt;/pathconvert&gt;
</pre>


+ 2
- 2
src/etc/testcases/types/mappers/globmapper.xml View File

@@ -1,9 +1,9 @@
<project>
<import file="define.mapperresult.xml"/>

<target name="handle.dirchar">
<target name="handle.dirsep">
<mapperresult input="d\e/f/j.java" output="f/j.java">
<globmapper from="d/e\*" to="*" handledirchar="yes"/>
<globmapper from="d/e\*" to="*" handledirsep="yes"/>
</mapperresult>
</target>


+ 2
- 2
src/etc/testcases/types/mappers/regexpmapper.xml View File

@@ -7,9 +7,9 @@
</mapperresult>
</target>

<target name="handle.dirchar">
<target name="handle.dirsep">
<mapperresult input="d\e/f\j.java" output="f/j.java">
<regexpmapper from="d/e/(.*)" to="\1" handledirchar="yes"/>
<regexpmapper from="d/e/(.*)" to="\1" handledirsep="yes"/>
</mapperresult>
</target>
</project>

+ 5
- 5
src/main/org/apache/tools/ant/util/GlobPatternMapper.java View File

@@ -62,17 +62,17 @@ public class GlobPatternMapper implements FileNameMapper {
*/
protected String toPostfix = null;

private boolean handleDirChar = false;
private boolean handleDirSep = false;
private boolean caseSensitive = true;

/**
* Attribute specifing whether to ignore the difference
* between / and \ (the two common directory characters).
* @param handleDirChar a boolean, default is false.
* @param handleDirSep a boolean, default is false.
* @since Ant 1.6.3
*/
public void setHandleDirChar(boolean handleDirChar) {
this.handleDirChar = handleDirChar;
public void setHandleDirSep(boolean handleDirSep) {
this.handleDirSep = handleDirSep;
}

/**
@@ -156,7 +156,7 @@ public class GlobPatternMapper implements FileNameMapper {
if (!caseSensitive) {
name = name.toLowerCase();
}
if (handleDirChar) {
if (handleDirSep) {
if (name.indexOf('\\') != -1) {
name = name.replace('\\', '/');
}


+ 5
- 5
src/main/org/apache/tools/ant/util/RegexpPatternMapper.java View File

@@ -40,17 +40,17 @@ public class RegexpPatternMapper implements FileNameMapper {
reg = (new RegexpMatcherFactory()).newRegexpMatcher();
}

private boolean handleDirChar = false;
private boolean handleDirSep = false;
private int regexpOptions = 0;

/**
* Attribute specifing whether to ignore the difference
* between / and \ (the two common directory characters).
* @param handleDirChar a boolean, default is false.
* @param handleDirSep a boolean, default is false.
* @since Ant 1.6.3
*/
public void setHandleDirChar(boolean handleDirChar) {
this.handleDirChar = handleDirChar;
public void setHandleDirSep(boolean handleDirSep) {
this.handleDirSep = handleDirSep;
}

/**
@@ -102,7 +102,7 @@ public class RegexpPatternMapper implements FileNameMapper {
* null if the to pattern did not match
*/
public String[] mapFileName(String sourceFileName) {
if (handleDirChar) {
if (handleDirSep) {
if (sourceFileName.indexOf("\\") != -1) {
sourceFileName = sourceFileName.replace('\\', '/');
}


+ 2
- 2
src/testcases/org/apache/tools/ant/types/mappers/GlobMapperTest.java View File

@@ -34,8 +34,8 @@ public class GlobMapperTest extends BuildFileTest {
public void testIgnoreCase() {
executeTarget("ignore.case");
}
public void testHandleDirChar() {
executeTarget("handle.dirchar");
public void testHandleDirSep() {
executeTarget("handle.dirsep");
}
}



+ 2
- 2
src/testcases/org/apache/tools/ant/types/mappers/RegexpPatternMapperTest.java View File

@@ -34,8 +34,8 @@ public class RegexpPatternMapperTest extends BuildFileTest {
public void testIgnoreCase() {
executeTarget("ignore.case");
}
public void testHandleDirChar() {
executeTarget("handle.dirchar");
public void testHandleDirSep() {
executeTarget("handle.dirsep");
}
}



Loading…
Cancel
Save