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

Unified Diff: sdk/lib/_internal/pub/lib/src/package.dart

Issue 566093003: Create binstubs for executables when activating a package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise! Created 6 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub/lib/src/package.dart
diff --git a/sdk/lib/_internal/pub/lib/src/package.dart b/sdk/lib/_internal/pub/lib/src/package.dart
index 3dd84e2d253facf02d1f199f47644495037b39df..e5fff8b6ad7efb8095c15bdeacc6fb18f35aa0f2 100644
--- a/sdk/lib/_internal/pub/lib/src/package.dart
+++ b/sdk/lib/_internal/pub/lib/src/package.dart
@@ -79,10 +79,7 @@ class Package {
/// Returns a list of asset ids for all Dart executables in this package's bin
/// directory.
List<AssetId> get executableIds {
- var binDir = path.join(dir, 'bin');
- if (!dirExists(binDir)) return [];
-
- return ordered(listFiles(beneath: binDir, recursive: false))
+ return ordered(listFiles(beneath: "bin", recursive: false))
.where((executable) => path.extension(executable) == '.dart')
.map((executable) {
return new AssetId(
@@ -142,11 +139,18 @@ class Package {
/// If this is a Git repository, this will respect .gitignore; otherwise, it
/// will return all non-hidden, non-blacklisted files.
///
- /// If [beneath] is passed, this will only return files beneath that path. If
+ /// If [beneath] is passed, this will only return files beneath that path,
+ /// which is expected to be relative to the package's root directory. If
/// [recursive] is true, this will return all files beneath that path;
/// otherwise, it will only return files one level beneath it.
List<String> listFiles({String beneath, recursive: true}) {
- if (beneath == null) beneath = dir;
+ if (beneath == null) {
+ beneath = dir;
+ } else {
+ beneath = path.join(dir, beneath);
+ }
+
+ if (!dirExists(beneath)) return [];
// This is used in some performance-sensitive paths and can list many, many
// files. As such, it leans more havily towards optimization as opposed to

Powered by Google App Engine
This is Rietveld 408576698