| OLD | NEW |
| 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 // symlink to. | 470 // symlink to. |
| 471 target = path.join(target, 'lib'); | 471 target = path.join(target, 'lib'); |
| 472 if (!dirExists(target)) return; | 472 if (!dirExists(target)) return; |
| 473 | 473 |
| 474 log.fine("Creating ${isSelfLink ? "self" : ""}link for package '$name'."); | 474 log.fine("Creating ${isSelfLink ? "self" : ""}link for package '$name'."); |
| 475 createSymlink(target, symlink, relative: relative); | 475 createSymlink(target, symlink, relative: relative); |
| 476 } | 476 } |
| 477 | 477 |
| 478 /// Whether pub is running from within the Dart SDK, as opposed to from the Dart | 478 /// Whether pub is running from within the Dart SDK, as opposed to from the Dart |
| 479 /// source repository. | 479 /// source repository. |
| 480 final bool runningFromSdk = Platform.script.path.endsWith('.snapshot'); | 480 final bool runningFromSdk = Platform.script.path.endsWith('.dart.snapshot'); |
| 481 | 481 |
| 482 /// Resolves [target] relative to the path to pub's `asset` directory. | 482 /// Resolves [target] relative to the path to pub's `asset` directory. |
| 483 String assetPath(String target) { | 483 String assetPath(String target) { |
| 484 if (runningFromSdk) { | 484 if (runningFromSdk) { |
| 485 return path.join( | 485 return path.join( |
| 486 sdk.rootDirectory, 'lib', '_internal', 'pub', 'asset', target); | 486 sdk.rootDirectory, 'lib', '_internal', 'pub', 'asset', target); |
| 487 } else { | 487 } else { |
| 488 return path.join(pubRoot, 'asset', target); | 488 return path.join(pubRoot, 'asset', target); |
| 489 } | 489 } |
| 490 } | 490 } |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 | 1010 |
| 1011 // TODO(rnystrom): Remove this and change to returning one string. | 1011 // TODO(rnystrom): Remove this and change to returning one string. |
| 1012 static List<String> _toLines(String output) { | 1012 static List<String> _toLines(String output) { |
| 1013 var lines = splitLines(output); | 1013 var lines = splitLines(output); |
| 1014 if (!lines.isEmpty && lines.last == "") lines.removeLast(); | 1014 if (!lines.isEmpty && lines.last == "") lines.removeLast(); |
| 1015 return lines; | 1015 return lines; |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 bool get success => exitCode == exit_codes.SUCCESS; | 1018 bool get success => exitCode == exit_codes.SUCCESS; |
| 1019 } | 1019 } |
| OLD | NEW |