| OLD | NEW |
| 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 } | 346 } |
| 347 | 347 |
| 348 // It's a new style package, so symlink to the 'lib' directory. But only | 348 // It's a new style package, so symlink to the 'lib' directory. But only |
| 349 // if the package actually *has* one. Otherwise, we won't create a | 349 // if the package actually *has* one. Otherwise, we won't create a |
| 350 // symlink at all. | 350 // symlink at all. |
| 351 from = join(from, 'lib'); | 351 from = join(from, 'lib'); |
| 352 return dirExists(from).chain((exists) { | 352 return dirExists(from).chain((exists) { |
| 353 if (exists) { | 353 if (exists) { |
| 354 return createSymlink(from, to); | 354 return createSymlink(from, to); |
| 355 } else { | 355 } else { |
| 356 printError('Warning: Package "$name" does not have a "lib" directory.'); | 356 // It's OK for the self link (i.e. the root package) to not have a lib |
| 357 // directory since it may just be a leaf application that only has |
| 358 // code in bin or web. |
| 359 if (!isSelfLink) { |
| 360 printError( |
| 361 'Warning: Package "$name" does not have a "lib" directory.'); |
| 362 } |
| 363 |
| 357 return new Future.immediate(to); | 364 return new Future.immediate(to); |
| 358 } | 365 } |
| 359 }); | 366 }); |
| 360 }); | 367 }); |
| 361 } | 368 } |
| 362 | 369 |
| 363 /** | 370 /** |
| 364 * Given [entry] which may be a [String], [File], or [Directory] relative to | 371 * Given [entry] which may be a [String], [File], or [Directory] relative to |
| 365 * the current working directory, returns its full canonicalized path. | 372 * the current working directory, returns its full canonicalized path. |
| 366 */ | 373 */ |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 return new Directory(entry); | 774 return new Directory(entry); |
| 768 } | 775 } |
| 769 | 776 |
| 770 /** | 777 /** |
| 771 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. | 778 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. |
| 772 */ | 779 */ |
| 773 Uri _getUri(uri) { | 780 Uri _getUri(uri) { |
| 774 if (uri is Uri) return uri; | 781 if (uri is Uri) return uri; |
| 775 return new Uri.fromString(uri); | 782 return new Uri.fromString(uri); |
| 776 } | 783 } |
| OLD | NEW |