Chromium Code Reviews| Index: utils/pub/path.dart |
| diff --git a/utils/pub/path.dart b/utils/pub/path.dart |
| index 593396d0b83490de1be419a829c36ac0b09b715a..109a926e5736eee727220793833b95afb2756b05 100644 |
| --- a/utils/pub/path.dart |
| +++ b/utils/pub/path.dart |
| @@ -294,7 +294,7 @@ class Builder { |
| buffer.clear(); |
| buffer.add(part); |
| } else { |
| - if (part.length > 0 && style.separatorPattern.hasMatch(part[0])) { |
| + if (part.length > 0 && part[0].contains(style.separatorPattern)) { |
|
Bob Nystrom
2012/12/18 19:40:35
A simpler fix here is to just make separatorPatter
nweiz
2012/12/19 01:10:21
I think using str.contains(pattern) is about as cl
|
| // The part starts with a separator, so we don't need to add one. |
| } else if (needsSeparator) { |
| buffer.add(separator); |
| @@ -306,7 +306,7 @@ class Builder { |
| // Unless this part ends with a separator, we'll need to add one before |
| // the next part. |
| needsSeparator = part.length > 0 && |
| - !style.separatorPattern.hasMatch(part[part.length - 1]); |
| + !part[part.length - 1].contains(style.separatorPattern); |
| } |
| return buffer.toString(); |
| @@ -524,9 +524,9 @@ class Style { |
| /// Gets the root prefix of [path] if path is absolute. If [path] is relative, |
| /// returns `null`. |
| String getRoot(String path) { |
| - var match = _rootPattern.firstMatch(path); |
| - if (match == null) return null; |
| - return match[0]; |
| + var matches = _rootPattern.allMatches(path).iterator(); |
| + if (!matches.hasNext) return null; |
| + return matches.next()[0]; |
| } |
| String toString() => name; |