Chromium Code Reviews

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

Issue 25385004: Fix pub to work with new Directory.createSystemTemp. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/system_cache.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/io.dart
diff --git a/sdk/lib/_internal/pub/lib/src/io.dart b/sdk/lib/_internal/pub/lib/src/io.dart
index 41a254392a1c0f75794633ccd82c3b2ca4ed1e31..af8168e461b073ad4ee1c712d40dc5d3e598a894 100644
--- a/sdk/lib/_internal/pub/lib/src/io.dart
+++ b/sdk/lib/_internal/pub/lib/src/io.dart
@@ -232,12 +232,19 @@ String ensureDir(String dirPath) {
/// suffix appended to it. If [dir] is not provided, a temp directory will be
/// created in a platform-dependent temporary location. Returns the path of the
/// created directory.
-String createTempDir([dir = '']) {
- var tempDir = new Directory(dir).createTempSync();
+String createTempDir(String base, String prefix) {
Bob Nystrom 2013/10/01 17:37:03 Is it a prefix or a suffix? The doc says one thing
Bill Hesse 2013/10/02 13:25:05 It is a prefix. Fixed the doc comment.
+ var tempDir = new Directory(base).createTempSync(prefix);
log.io("Created temp directory ${tempDir.path}");
return tempDir.path;
}
+String createSystemTempDir() {
Bob Nystrom 2013/10/01 17:37:03 Doc comment. Or just combine this with the above m
Bill Hesse 2013/10/02 13:25:05 Done.
+ var tempDir = Directory.createSystemTempSync('pub_');
+ log.io("Created temp directory ${tempDir.path}");
+ return tempDir.path;
+}
+
Bob Nystrom 2013/10/01 17:37:03 Remove extra blank line.
Bill Hesse 2013/10/02 13:25:05 Done.
+
/// Lists the contents of [dir]. If [recursive] is `true`, lists subdirectory
/// contents (defaults to `false`). If [includeHidden] is `true`, includes files
/// and directories beginning with `.` (defaults to `false`).
@@ -648,7 +655,7 @@ Future timeout(Future input, int milliseconds, String description) {
/// [fn] completes to.
Future withTempDir(Future fn(String path)) {
return new Future.sync(() {
- var tempDir = createTempDir();
+ var tempDir = createSystemTempDir();
return new Future.sync(() => fn(tempDir))
.whenComplete(() => deleteEntry(tempDir));
});
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/system_cache.dart » ('j') | no next file with comments »

Powered by Google App Engine