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

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

Issue 14452004: Fix mirror usage in pub test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
« no previous file with comments | « no previous file | no next file » | 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 /// Generic utility functions. Stuff that should possibly be in core. 5 /// Generic utility functions. Stuff that should possibly be in core.
6 library utils; 6 library utils;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:crypto'; 9 import 'dart:crypto';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 var map = {}; 356 var map = {};
357 for (var pair in resolvedPairs) { 357 for (var pair in resolvedPairs) {
358 map[pair.first] = pair.last; 358 map[pair.first] = pair.last;
359 } 359 }
360 return map; 360 return map;
361 }); 361 });
362 } 362 }
363 363
364 /// Returns the path to the library named [libraryName]. The library name must 364 /// Returns the path to the library named [libraryName]. The library name must
365 /// be globally unique, or the wrong library path may be returned. 365 /// be globally unique, or the wrong library path may be returned.
366 String libraryPath(String libraryName) => 366 String libraryPath(String libraryName) {
367 fileUriToPath(currentMirrorSystem().libraries[new Symbol(libraryName)].uri); 367 var libraries = currentMirrorSystem().findLibrary(new Symbol(libraryName));
368 return fileUriToPath(libraries.single.uri);
369 }
368 370
369 /// Converts a `file:` [Uri] to a local path string. 371 /// Converts a `file:` [Uri] to a local path string.
370 String fileUriToPath(Uri uri) { 372 String fileUriToPath(Uri uri) {
371 if (uri.scheme != 'file') { 373 if (uri.scheme != 'file') {
372 throw new ArgumentError("Uri $uri must have scheme 'file:'."); 374 throw new ArgumentError("Uri $uri must have scheme 'file:'.");
373 } 375 }
374 if (Platform.operatingSystem != 'windows') return uri.path; 376 if (Platform.operatingSystem != 'windows') return uri.path;
375 if (uri.path.startsWith("/")) { 377 if (uri.path.startsWith("/")) {
376 // Drive-letter paths look like "file:///C:/path/to/file". The replaceFirst 378 // Drive-letter paths look like "file:///C:/path/to/file". The replaceFirst
377 // removes the extra initial slash. 379 // removes the extra initial slash.
(...skipping 27 matching lines...) Expand all
405 error is FileIOException || 407 error is FileIOException ||
406 error is HttpException || 408 error is HttpException ||
407 error is HttpParserException || 409 error is HttpParserException ||
408 error is LinkIOException || 410 error is LinkIOException ||
409 error is MimeParserException || 411 error is MimeParserException ||
410 error is OSError || 412 error is OSError ||
411 error is ProcessException || 413 error is ProcessException ||
412 error is SocketIOException || 414 error is SocketIOException ||
413 error is WebSocketException; 415 error is WebSocketException;
414 } 416 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698