| Index: pkg/path/lib/path.dart
|
| diff --git a/pkg/path/lib/path.dart b/pkg/path/lib/path.dart
|
| index 3c5f51eb3ea967285dfa8aee4586088c21e8a588..5d49097818b5fa82fac63805f9f225fa569bf7b2 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);
|
| } else if (this.isAbsolute(part)) {
|
| isAbsoluteAndNotRootRelative = !this.isRootRelative(part);
|
| // An absolute path discards everything before it.
|
| @@ -983,6 +986,10 @@ class _WindowsStyle extends Style {
|
| final needsSeparatorPattern = new RegExp(r'[^/\\]$');
|
| final rootPattern = new RegExp(r'^(\\\\[^\\]+\\[^\\/]+|[a-zA-Z]:[/\\])');
|
|
|
| + // Matches a back or forward slash that's not followed by another back or
|
| + // forward slash.
|
| + final relativeRootPattern = new RegExp(r"^[/\\](?![/\\])");
|
| +
|
| String pathFromUri(Uri uri) {
|
| if (uri.scheme != '' && uri.scheme != 'file') {
|
| throw new ArgumentError("Uri $uri must have scheme 'file:'.");
|
|
|