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

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

Issue 11312133: Pass absolute path to git (redux). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Jiggle the handle. Created 8 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 | « utils/pub/git_source.dart ('k') | utils/tests/pub/pub.status » ('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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 printError( 366 printError(
367 'Warning: Package "$name" does not have a "lib" directory.'); 367 'Warning: Package "$name" does not have a "lib" directory.');
368 } 368 }
369 369
370 return new Future.immediate(to); 370 return new Future.immediate(to);
371 } 371 }
372 }); 372 });
373 }); 373 });
374 } 374 }
375 375
376 /** 376 /// Given [entry] which may be a [String], [File], or [Directory] relative to
377 * Given [entry] which may be a [String], [File], or [Directory] relative to 377 /// the current working directory, returns its full canonicalized path.
378 * the current working directory, returns its full canonicalized path. 378 String getFullPath(entry) {
379 */ 379 var path = new Path(_getPath(entry));
380 // TODO(rnystrom): Should this be async? 380
381 String getFullPath(entry) => new File(_getPath(entry)).fullPathSync(); 381 // Don't do anything if it's already absolute.
382 if (path.isAbsolute) return path.toNativePath();
383
384 // Using Path.join here instead of File().fullPathSync() because the former
385 // does not require an actual file to exist at that path.
386 return new Path.fromNative(workingDir).join(path).toNativePath();
387 }
382 388
383 // TODO(nweiz): make this configurable 389 // TODO(nweiz): make this configurable
384 /** 390 /**
385 * The amount of time in milliseconds to allow HTTP requests before assuming 391 * The amount of time in milliseconds to allow HTTP requests before assuming
386 * they've failed. 392 * they've failed.
387 */ 393 */
388 final HTTP_TIMEOUT = 30 * 1000; 394 final HTTP_TIMEOUT = 30 * 1000;
389 395
390 /** 396 /**
391 * Opens an input stream for a HTTP GET request to [uri], which may be a 397 * Opens an input stream for a HTTP GET request to [uri], which may be a
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 return new Directory(entry); 767 return new Directory(entry);
762 } 768 }
763 769
764 /** 770 /**
765 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. 771 * Gets a [Uri] for [uri], which can either already be one, or be a [String].
766 */ 772 */
767 Uri _getUri(uri) { 773 Uri _getUri(uri) {
768 if (uri is Uri) return uri; 774 if (uri is Uri) return uri;
769 return new Uri.fromString(uri); 775 return new Uri.fromString(uri);
770 } 776 }
OLDNEW
« no previous file with comments | « utils/pub/git_source.dart ('k') | utils/tests/pub/pub.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698