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

Unified Diff: utils/pub/system_cache.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/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 634dc173257b0e9742a549f86e6903fae9b855be..2fec00262e77ce2ee2baa039a81240b1ed755fa1 100644
--- a/utils/pub/system_cache.dart
+++ b/utils/pub/system_cache.dart
@@ -71,8 +71,8 @@ class SystemCache {
// Try to get it from the system cache first.
if (id.source.shouldCache) {
return id.systemCacheDirectory.then((packageDir) {
- if (!dirExistsSync(packageDir)) return getUncached();
- return Package.load(id.name, packageDir, sources);
+ if (!dirExists(packageDir)) return getUncached();
+ return new Package(id.name, packageDir, sources);
});
}
@@ -105,7 +105,8 @@ class SystemCache {
/// temp directory to ensure that it's on the same volume as the pub system
/// cache so that it can move the directory from it.
Future<Directory> createTempDir() {
- return ensureDir(tempDir).then((temp) {
+ return defer(() {
+ var temp = ensureDir(tempDir);
return io.createTempDir(join(temp, 'dir'));
});
}
@@ -113,8 +114,8 @@ class SystemCache {
/// Delete's the system cache's internal temp directory.
Future deleteTempDir() {
log.fine('Clean up system cache temp directory $tempDir.');
- return dirExists(tempDir).then((exists) {
- if (!exists) return;
+ return defer(() {
+ if (!dirExists(tempDir)) return;
return deleteDir(tempDir);
});
}
« 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