From 3c4ecd98691ca1744e5f45680922c8e42c71e73f Mon Sep 17 00:00:00 2001 From: "Vladimir.Orlov" Date: Fri, 3 Oct 2014 12:06:42 +0400 Subject: [PATCH] IDEA-130718 Updater leaves behind a broken installation if it fails to open a file on Windows --- updater/src/com/intellij/updater/DeleteAction.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/updater/src/com/intellij/updater/DeleteAction.java b/updater/src/com/intellij/updater/DeleteAction.java index 3dd1b850e415..8bc43ac41bb1 100644 --- a/updater/src/com/intellij/updater/DeleteAction.java +++ b/updater/src/com/intellij/updater/DeleteAction.java @@ -51,7 +51,9 @@ public class DeleteAction extends PatchAction { } protected void doRevert(File toFile, File backupFile) throws IOException { - Utils.delete(toFile); // make sure there is no directory remained on this path (may remain from previous 'create' actions - Utils.copy(backupFile, toFile); + if (!toFile.exists() || isModified(toFile)) { + Utils.delete(toFile); // make sure there is no directory remained on this path (may remain from previous 'create' actions + Utils.copy(backupFile, toFile); + } } }