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

Unified Diff: utils/pub/system_cache.dart

Issue 10695132: Reverting 9527 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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/source.dart ('k') | utils/pub/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/system_cache.dart
diff --git a/utils/pub/system_cache.dart b/utils/pub/system_cache.dart
index fd9035417ebe4c31d0d3fc26370dca3735c332b8..8065f9a16606650b5a7f347205fc89fa8e27d3e6 100644
--- a/utils/pub/system_cache.dart
+++ b/utils/pub/system_cache.dart
@@ -82,7 +82,18 @@ class SystemCache {
var pending = _pendingInstalls[id];
if (pending != null) return pending;
- var future = id.source.installToSystemCache(id);
+ var path = id.source.systemCacheDirectory(id);
+ var future = exists(path).chain((exists) {
+ // TODO(nweiz): better error handling
+ if (exists) throw 'Package $id is already installed.';
+ return ensureDir(dirname(path));
+ }).chain((_) {
+ return id.source.install(id, path);
+ }).chain((found) {
+ if (!found) throw 'Package $id not found.';
+ return Package.load(path, sources);
+ });
+
always(future, () => _pendingInstalls.remove(id));
_pendingInstalls[id] = future;
return future;
« no previous file with comments | « utils/pub/source.dart ('k') | utils/pub/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698