| Index: pkg/path/lib/src/context.dart
|
| diff --git a/pkg/path/lib/src/context.dart b/pkg/path/lib/src/context.dart
|
| index b897c8ba53310d6a890c258bc5821c08b14427c5..9c8e1e46465b489ccfa7c13d6610d80c0562b489 100644
|
| --- a/pkg/path/lib/src/context.dart
|
| +++ b/pkg/path/lib/src/context.dart
|
| @@ -423,23 +423,30 @@ class Context {
|
| return parsed.toString();
|
| }
|
|
|
| - /// Returns the path represented by [uri].
|
| + /// Returns the path represented by [uri], which may be a [String] or a [Uri].
|
| ///
|
| /// For POSIX and Windows styles, [uri] must be a `file:` URI. For the URL
|
| /// style, this will just convert [uri] to a string.
|
| ///
|
| /// // POSIX
|
| - /// context.fromUri(Uri.parse('file:///path/to/foo'))
|
| + /// context.fromUri('file:///path/to/foo')
|
| /// // -> '/path/to/foo'
|
| ///
|
| /// // Windows
|
| - /// context.fromUri(Uri.parse('file:///C:/path/to/foo'))
|
| + /// context.fromUri('file:///C:/path/to/foo')
|
| /// // -> r'C:\path\to\foo'
|
| ///
|
| /// // URL
|
| - /// context.fromUri(Uri.parse('http://dartlang.org/path/to/foo'))
|
| + /// context.fromUri('http://dartlang.org/path/to/foo')
|
| /// // -> 'http://dartlang.org/path/to/foo'
|
| - String fromUri(Uri uri) => style.pathFromUri(uri);
|
| + ///
|
| + /// If [uri] is relative, a relative path will be returned.
|
| + ///
|
| + /// path.fromUri('path/to/foo'); // -> 'path/to/foo'
|
| + String fromUri(uri) {
|
| + if (uri is String) uri = Uri.parse(uri);
|
| + return style.pathFromUri(uri);
|
| + }
|
|
|
| /// Returns the URI that represents [path].
|
| ///
|
|
|