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

Unified Diff: utils/pub/io.dart

Issue 11151026: Download to a temp dir and rename on success. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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 | « utils/pub/hosted_source.dart ('k') | utils/pub/version_solver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/io.dart
diff --git a/utils/pub/io.dart b/utils/pub/io.dart
index bef2b2ae37e5f7d648c3203e3ad66e9c6cafec23..20852ca6f74a5148d9cf899672017738a628d528 100644
--- a/utils/pub/io.dart
+++ b/utils/pub/io.dart
@@ -283,6 +283,13 @@ Future<Directory> cleanDir(dir) {
});
}
+/// Renames (i.e. moves) the directory [from] to [to]. Returns a [Future] with
+/// the destination directory.
+Future<Directory> renameDir(from, String to) {
+ from = _getDirectory(from);
+ return from.rename(to);
nweiz 2012/10/15 20:56:27 Style nit: this would be cleaner as a one-liner.
Bob Nystrom 2012/10/15 20:59:23 Done.
+}
+
/**
* Creates a new symlink that creates an alias from [from] to [to], both of
* which can be a [String], [File], or [Directory]. Returns a [Future] which
@@ -690,6 +697,7 @@ Future<bool> _extractTarGzWindows(InputStream stream, String destination) {
}).chain((result) {
if (result.exitCode != 0) {
throw 'Could not un-gzip (exit code ${result.exitCode}). Error:\n'
+ '${Strings.join(result.stdout, "\n")}\n'
'${Strings.join(result.stderr, "\n")}';
}
« no previous file with comments | « utils/pub/hosted_source.dart ('k') | utils/pub/version_solver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698