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

Unified Diff: utils/pub/source.dart

Issue 12079112: Make a bunch of stuff in pub synchronous. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix after merge. Created 7 years, 11 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
« no previous file with comments | « utils/pub/sdk_source.dart ('k') | utils/pub/system_cache.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/source.dart
diff --git a/utils/pub/source.dart b/utils/pub/source.dart
index d086374f3bffcde40dd21c2b202bcdd582bfbc80..977efad3a59c73e369039d1216d5952bbf6fd26d 100644
--- a/utils/pub/source.dart
+++ b/utils/pub/source.dart
@@ -9,6 +9,7 @@ import 'io.dart';
import 'package.dart';
import 'pubspec.dart';
import 'system_cache.dart';
+import 'utils.dart';
import 'version.dart';
/// A source from which to install packages.
@@ -104,14 +105,15 @@ abstract class Source {
///
/// By default, this uses [systemCacheDirectory] and [install].
Future<Package> installToSystemCache(PackageId id) {
- return systemCacheDirectory(id).then((path) {
- return exists(path).then((exists) {
- if (exists) return new Future<bool>.immediate(true);
- return ensureDir(dirname(path)).then((_) => install(id, path));
- }).then((found) {
- if (!found) throw 'Package $id not found.';
- return Package.load(id.name, path, systemCache.sources);
- });
+ var path;
+ return systemCacheDirectory(id).then((p) {
+ path = p;
+ if (dirExists(path)) return true;
+ ensureDir(dirname(path));
+ return install(id, path);
+ }).then((found) {
+ if (!found) throw 'Package $id not found.';
+ return new Package(id.name, path, systemCache.sources);
});
}
« no previous file with comments | « utils/pub/sdk_source.dart ('k') | utils/pub/system_cache.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698