Skip to content
Snippets Groups Projects
Commit 8f50fe99 authored by nweiz@google.com's avatar nweiz@google.com Committed by Natalie Weizenbaum
Browse files

Ensure that renames fail atomically in pub.

R=rnystrom@google.com
BUG=12436

Review URL: https://codereview.chromium.org//22799008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@26150 260f80e4-7a28-3924-810f-c04153c831b5
parent 7a610f05
No related branches found
No related tags found
No related merge requests found
......@@ -309,7 +309,13 @@ void cleanDir(String dir) {
/// Renames (i.e. moves) the directory [from] to [to].
void renameDir(String from, String to) {
log.io("Renaming directory $from to $to.");
new Directory(from).renameSync(to);
try {
new Directory(from).renameSync(to);
} on IOException catch (error) {
// Ensure that [to] isn't left in an inconsistent state. See issue 12436.
if (entryExists(to)) deleteEntry(to);
rethrow;
}
}
/// Creates a new symlink at path [symlink] that points to [target]. Returns a
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment