Chromium Code Reviews| Index: pkg/path/lib/path.dart |
| diff --git a/pkg/path/lib/path.dart b/pkg/path/lib/path.dart |
| index 3c5f51eb3ea967285dfa8aee4586088c21e8a588..07bded709d6a36558fc8e7595ae34f7013c89b54 100644 |
| --- a/pkg/path/lib/path.dart |
| +++ b/pkg/path/lib/path.dart |
| @@ -560,10 +560,13 @@ class Builder { |
| if (this.isRootRelative(part) && isAbsoluteAndNotRootRelative) { |
| // If the new part is root-relative, it preserves the previous root but |
| // replaces the path after it. |
| - var oldRoot = this.rootPrefix(buffer.toString()); |
| + var parsed = _parse(part); |
| + parsed.root = this.rootPrefix(buffer.toString()); |
| + if (parsed.root.contains(style.needsSeparatorPattern)) { |
| + parsed.separators[0] = style.separator; |
| + } |
| buffer.clear(); |
| - buffer.write(oldRoot); |
| - buffer.write(part); |
| + buffer.write(parsed.toString()); |
|
Bob Nystrom
2013/11/14 17:05:08
The toString() isn't needed here.
nweiz
2013/11/14 21:10:17
Done.
|
| } else if (this.isAbsolute(part)) { |
| isAbsoluteAndNotRootRelative = !this.isRootRelative(part); |
| // An absolute path discards everything before it. |
| @@ -982,6 +985,7 @@ class _WindowsStyle extends Style { |
| final separatorPattern = new RegExp(r'[/\\]'); |
| final needsSeparatorPattern = new RegExp(r'[^/\\]$'); |
| final rootPattern = new RegExp(r'^(\\\\[^\\]+\\[^\\/]+|[a-zA-Z]:[/\\])'); |
| + final relativeRootPattern = new RegExp(r"^[/\\](?![/\\])"); |
|
Bob Nystrom
2013/11/14 17:05:08
Doc comment for this please. Regexen are opaque.
nweiz
2013/11/14 21:10:17
Done.
|
| String pathFromUri(Uri uri) { |
| if (uri.scheme != '' && uri.scheme != 'file') { |