Re-implement renameDirAlmostAtomically in Builder#complete.

The `rename` is not sufficient on its own since it won't pave the way
for the new directory by ensuring that it's empty first.

`renameDirAlmostAtomically` will do that.
This commit is contained in:
Jesse Rosenberger
2017-04-06 17:16:03 +03:00
parent 523c7ce9d4
commit 7090129f89

View File

@@ -688,7 +688,7 @@ Previous builder: ${previousBuilder.outputPath}, this builder: ${outputPath}`
// be checked in to version control, but here we could get away with it.
if (this.buildPath !== this.outputPath) {
try {
files.rename(this.buildPath, this.outputPath);
files.renameDirAlmostAtomically(this.buildPath, this.outputPath);
} catch (e) {
if (e.code === "EXDEV") {
files.rm_recursive(this.outputPath);