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

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

Issue 75543013: Make the stack_trace package print relative URLs for browser paths. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 7 years, 1 month 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
« no previous file with comments | « no previous file | pkg/stack_trace/lib/src/frame.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 /// An internal context for the current OS so we can provide a straight 72 /// An internal context for the current OS so we can provide a straight
73 /// functional interface and not require users to create one. 73 /// functional interface and not require users to create one.
74 Context get _context { 74 Context get _context {
75 if (_cachedContext != null && Uri.base == _lastBaseUri) return _cachedContext; 75 if (_cachedContext != null && Uri.base == _lastBaseUri) return _cachedContext;
76 _lastBaseUri = Uri.base; 76 _lastBaseUri = Uri.base;
77 _cachedContext = new Context(); 77 _cachedContext = new Context();
78 return _cachedContext; 78 return _cachedContext;
79 } 79 }
80 Context _cachedContext; 80 Context _cachedContext;
81 81
82 /// Returns the [Style] of the current context.
83 ///
84 /// This is the style that all top-level path functions will use.
85 Style get style => _context.style;
86
82 /// Gets the path to the current working directory. 87 /// Gets the path to the current working directory.
83 /// 88 ///
84 /// In the browser, this means the current URL, without the last file segment. 89 /// In the browser, this means the current URL, without the last file segment.
85 String get current { 90 String get current {
86 var uri = Uri.base; 91 var uri = Uri.base;
87 if (Style.platform == Style.url) { 92 if (Style.platform == Style.url) {
88 return uri.resolve('.').toString(); 93 return uri.resolve('.').toString();
89 } else { 94 } else {
90 var path = uri.toFilePath(); 95 var path = uri.toFilePath();
91 // Remove trailing '/' or '\'. 96 // Remove trailing '/' or '\'.
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 /// 355 ///
351 /// // URL 356 /// // URL
352 /// path.toUri('http://dartlang.org/path/to/foo') 357 /// path.toUri('http://dartlang.org/path/to/foo')
353 /// // -> Uri.parse('http://dartlang.org/path/to/foo') 358 /// // -> Uri.parse('http://dartlang.org/path/to/foo')
354 /// 359 ///
355 /// If [path] is relative, a relative URI will be returned. 360 /// If [path] is relative, a relative URI will be returned.
356 /// 361 ///
357 /// path.toUri('path/to/foo') 362 /// path.toUri('path/to/foo')
358 /// // -> Uri.parse('path/to/foo') 363 /// // -> Uri.parse('path/to/foo')
359 Uri toUri(String path) => _context.toUri(path); 364 Uri toUri(String path) => _context.toUri(path);
OLDNEW
« no previous file with comments | « no previous file | pkg/stack_trace/lib/src/frame.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698