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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/io.dart

Issue 46063010: Change dart:io Platform.script to return a Uri. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased 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 | « sdk/lib/_internal/dartdoc/test/dartdoc_test.dart ('k') | sdk/lib/io/platform.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 /// Helper functionality to make working with IO easier. 5 /// Helper functionality to make working with IO easier.
6 library pub.io; 6 library pub.io;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:collection'; 9 import 'dart:collection';
10 import 'dart:convert'; 10 import 'dart:convert';
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // directory since it may just be a leaf application that only has 374 // directory since it may just be a leaf application that only has
375 // code in bin or web. 375 // code in bin or web.
376 if (!isSelfLink) { 376 if (!isSelfLink) {
377 log.warning('Warning: Package "$name" does not have a "lib" directory so ' 377 log.warning('Warning: Package "$name" does not have a "lib" directory so '
378 'you will not be able to import any libraries from it.'); 378 'you will not be able to import any libraries from it.');
379 } 379 }
380 } 380 }
381 381
382 /// Whether pub is running from within the Dart SDK, as opposed to from the Dart 382 /// Whether pub is running from within the Dart SDK, as opposed to from the Dart
383 /// source repository. 383 /// source repository.
384 bool get runningFromSdk => path.extension(Platform.script) == '.snapshot'; 384 bool get runningFromSdk => Platform.script.path.endsWith('.snapshot');
385 385
386 /// Resolves [target] relative to the path to pub's `resource` directory. 386 /// Resolves [target] relative to the path to pub's `resource` directory.
387 String resourcePath(String target) { 387 String resourcePath(String target) {
388 if (runningFromSdk) { 388 if (runningFromSdk) {
389 return path.join( 389 return path.join(
390 sdk.rootDirectory, 'lib', '_internal', 'pub', 'resource', target); 390 sdk.rootDirectory, 'lib', '_internal', 'pub', 'resource', target);
391 } else { 391 } else {
392 return path.join( 392 return path.join(
393 path.dirname(libraryPath('pub.io')), '..', '..', 'resource', target); 393 path.dirname(libraryPath('pub.io')), '..', '..', 'resource', target);
394 } 394 }
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 const PubProcessResult(this.stdout, this.stderr, this.exitCode); 834 const PubProcessResult(this.stdout, this.stderr, this.exitCode);
835 835
836 bool get success => exitCode == 0; 836 bool get success => exitCode == 0;
837 } 837 }
838 838
839 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. 839 /// Gets a [Uri] for [uri], which can either already be one, or be a [String].
840 Uri _getUri(uri) { 840 Uri _getUri(uri) {
841 if (uri is Uri) return uri; 841 if (uri is Uri) return uri;
842 return Uri.parse(uri); 842 return Uri.parse(uri);
843 } 843 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/dartdoc/test/dartdoc_test.dart ('k') | sdk/lib/io/platform.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698