Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1275)

Unified Diff: pkg/path/lib/path.dart

Issue 203673003: Allow [path.fromUri] to take a string as well as a URI. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/path/CHANGELOG.md ('k') | pkg/path/lib/src/context.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/path/lib/path.dart
diff --git a/pkg/path/lib/path.dart b/pkg/path/lib/path.dart
index 7ff858ce44e90c97420c82af19482e95195f6789..524f16dc0115fdcd36f6e820265415df6d800602 100644
--- a/pkg/path/lib/path.dart
+++ b/pkg/path/lib/path.dart
@@ -322,23 +322,27 @@ bool isWithin(String parent, String child) => _context.isWithin(parent, child);
/// withoutExtension('path/to/foo.dart'); // -> 'path/to/foo'
String withoutExtension(String path) => _context.withoutExtension(path);
-/// 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
-/// path.fromUri(Uri.parse('file:///path/to/foo'))
+/// context.fromUri('file:///path/to/foo')
/// // -> '/path/to/foo'
///
/// // Windows
-/// path.fromUri(Uri.parse('file:///C:/path/to/foo'))
+/// context.fromUri('file:///C:/path/to/foo')
/// // -> r'C:\path\to\foo'
///
/// // URL
-/// path.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) => _context.fromUri(uri);
+///
+/// If [uri] is relative, a relative path will be returned.
+///
+/// path.fromUri('path/to/foo'); // -> 'path/to/foo'
+String fromUri(uri) => _context.fromUri(uri);
/// Returns the URI that represents [path].
///
« no previous file with comments | « pkg/path/CHANGELOG.md ('k') | pkg/path/lib/src/context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698