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

Unified Diff: dart/utils/pub/system_cache.dart

Issue 11174004: Merge revisions 13674, 13676, 13677, 13678 to trunk (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 2 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 | « dart/utils/pub/pub.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/utils/pub/system_cache.dart
===================================================================
--- dart/utils/pub/system_cache.dart (revision 13677)
+++ dart/utils/pub/system_cache.dart (working copy)
@@ -4,7 +4,10 @@
library system_cache;
+import 'dart:io';
+
import 'io.dart';
+import 'io.dart' as io show createTempDir;
import 'package.dart';
import 'source.dart';
import 'source_registry.dart';
@@ -23,6 +26,8 @@
*/
final String rootDir;
+ String get tempDir => join(rootDir, '_temp');
+
/**
* Packages which are currently being asynchronously installed to the cache.
*/
@@ -70,4 +75,23 @@
_pendingInstalls[id] = future;
return future;
}
+
+ /// Create a new temporary directory within the system cache. The system
+ /// cache maintains its own temporary directory that it uses to stage
+ /// packages into while installing. It uses this instead of the OS's system
+ /// 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).chain((temp) {
+ return io.createTempDir(join(temp, 'dir'));
+ });
+ }
+
+ /// Delete's the system cache's internal temp directory.
+ Future deleteTempDir() {
+ return dirExists(tempDir).chain((exists) {
+ if (!exists) return new Future.immediate(null);
+ return deleteDir(tempDir);
+ });
+ }
}
« no previous file with comments | « dart/utils/pub/pub.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698