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

Side by Side Diff: utils/pub/io.dart

Issue 10948046: Create a sensible package cache directory on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | utils/pub/pub.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 /** 5 /**
6 * Helper functionality to make working with IO easier. 6 * Helper functionality to make working with IO easier.
7 */ 7 */
8 #library('io'); 8 #library('io');
9 9
10 #import('dart:io'); 10 #import('dart:io');
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // automatically attach a timeout to that stream. 362 // automatically attach a timeout to that stream.
363 uri = _getUri(uri); 363 uri = _getUri(uri);
364 364
365 var completer = new Completer<InputStream>(); 365 var completer = new Completer<InputStream>();
366 var client = new HttpClient(); 366 var client = new HttpClient();
367 var connection = client.getUrl(uri); 367 var connection = client.getUrl(uri);
368 368
369 connection.onError = (e) { 369 connection.onError = (e) {
370 // Show a friendly error if the URL couldn't be resolved. 370 // Show a friendly error if the URL couldn't be resolved.
371 if (e is SocketIOException && 371 if (e is SocketIOException &&
372 e.osError != null &&
372 (e.osError.errorCode == 8 || 373 (e.osError.errorCode == 8 ||
373 e.osError.errorCode == -2 || 374 e.osError.errorCode == -2 ||
374 e.osError.errorCode == -5 || 375 e.osError.errorCode == -5 ||
375 e.osError.errorCode == 11004)) { 376 e.osError.errorCode == 11004)) {
376 e = 'Could not resolve URL "${uri.origin}".'; 377 e = 'Could not resolve URL "${uri.origin}".';
377 } 378 }
378 379
379 client.shutdown(); 380 client.shutdown();
380 completer.completeException(e); 381 completer.completeException(e);
381 }; 382 };
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 return new Directory(entry); 706 return new Directory(entry);
706 } 707 }
707 708
708 /** 709 /**
709 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. 710 * Gets a [Uri] for [uri], which can either already be one, or be a [String].
710 */ 711 */
711 Uri _getUri(uri) { 712 Uri _getUri(uri) {
712 if (uri is Uri) return uri; 713 if (uri is Uri) return uri;
713 return new Uri.fromString(uri); 714 return new Uri.fromString(uri);
714 } 715 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698