Browse Source

use array version of tokenize path for rtrim

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@436720 13f79535-47bb-0310-9956-ffa450edef68
master
Kevin Jackson 19 years ago
parent
commit
19397fb959
1 changed files with 7 additions and 8 deletions
  1. +7
    -8
      src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java

+ 7
- 8
src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2005 The Apache Software Foundation
* Copyright 2002-2006 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -471,7 +471,7 @@ public final class SelectorUtils {
}
return true;
}
/**
* Breaks a path up into a Vector of path elements, tokenizing on
* <code>File.separator</code>.
@@ -557,7 +557,6 @@ public final class SelectorUtils {
return l;
}


/**
* Returns dependency information on these two files. If src has been
* modified later than target, it returns true. If target doesn't exist,
@@ -666,16 +665,16 @@ public final class SelectorUtils {
* @return the leftmost part of the pattern without wildcards
*/
public static String rtrimWildcardTokens(String input) {
Vector v = tokenizePath(input, File.separator);
String[] tokens = tokenizePathAsArray(input);
StringBuffer sb = new StringBuffer();
for (int counter = 0; counter < v.size(); counter++) {
if (hasWildcards((String) v.elementAt(counter))) {
for (int i = 0; i < tokens.length; i++) {
if (hasWildcards(tokens[i])) {
break;
}
if (counter > 0 && sb.charAt(sb.length() - 1) != File.separatorChar) {
if (i > 0 && sb.charAt(sb.length() - 1) != File.separatorChar) {
sb.append(File.separator);
}
sb.append((String) v.elementAt(counter));
sb.append(tokens[i]);
}
return sb.toString();
}


Loading…
Cancel
Save