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

Side by Side Diff: pkg/path/lib/path.dart

Issue 296233002: Add a path.formatUri method and release path 1.2.0. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// A comprehensive, cross-platform path manipulation library. 5 /// A comprehensive, cross-platform path manipulation library.
6 /// 6 ///
7 /// ## Installing ## 7 /// ## Installing ##
8 /// 8 ///
9 /// Use [pub][] to install this package. Add the following to your 9 /// Use [pub][] to install this package. Add the following to your
10 /// `pubspec.yaml` file. 10 /// `pubspec.yaml` file.
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 /// 359 ///
360 /// // URL 360 /// // URL
361 /// path.toUri('http://dartlang.org/path/to/foo') 361 /// path.toUri('http://dartlang.org/path/to/foo')
362 /// // -> Uri.parse('http://dartlang.org/path/to/foo') 362 /// // -> Uri.parse('http://dartlang.org/path/to/foo')
363 /// 363 ///
364 /// If [path] is relative, a relative URI will be returned. 364 /// If [path] is relative, a relative URI will be returned.
365 /// 365 ///
366 /// path.toUri('path/to/foo') 366 /// path.toUri('path/to/foo')
367 /// // -> Uri.parse('path/to/foo') 367 /// // -> Uri.parse('path/to/foo')
368 Uri toUri(String path) => _context.toUri(path); 368 Uri toUri(String path) => _context.toUri(path);
369
370 /// Returns a human-readable representation of [uri].
Bob Nystrom 2014/05/23 21:57:52 "a human" -> "a terse, human".
nweiz 2014/05/23 22:18:04 Done.
371 ///
372 /// If [uri] can be made relative to the current working directory, that's
Bob Nystrom 2014/05/23 21:57:52 Document what types uri may be.
nweiz 2014/05/23 22:18:04 Done.
373 /// done. Otherwise, it's returned as-is. This gracefully handles non-`file:`
374 /// URIs for [Style.posix] and [Style.windows].
375 ///
376 /// The returned value is meant for human consumption, and may be either URI-
377 /// or path-formatted.
378 ///
379 /// // POSIX at "/root/path"
380 /// path.formatUri('file:///root/path/a/b.dart'); // -> 'a/b.dart'
381 /// path.formatUri('http://dartlang.org/'); // -> 'http://dartlang.org'
382 ///
383 /// // Windows at "C:\root\path"
384 /// path.formatUri('file:///C:/root/path/a/b.dart'); // -> r'a\b.dart'
385 /// path.formatUri('http://dartlang.org/'); // -> 'http://dartlang.org'
386 ///
387 /// // URL at "http://dartlang.org/root/path"
388 /// path.formatUri('http://dartlang.org/root/path/a/b.dart');
389 /// // -> r'a/b.dart'
390 /// path.formatUri('file:///root/path'); // -> 'file:///root/path'
Bob Nystrom 2014/05/23 21:57:52 Should this normalize too?
nweiz 2014/05/23 22:18:04 Good idea, done.
391 String formatUri(uri) => _context.formatUri(uri);
Bob Nystrom 2014/05/23 21:57:52 "format" still feels wrong to me. I expect it to t
nweiz 2014/05/23 22:18:04 I feel like "format" can be interpreted in the sam
Bob Nystrom 2014/05/23 22:24:38 I like "pretty" a lot more than "format". It makes
nweiz 2014/05/23 22:36:55 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698