diff --git a/updater/src/com/intellij/updater/CreateAction.java b/updater/src/com/intellij/updater/CreateAction.java index e5bc063ed8ff..5e09094b1408 100644 --- a/updater/src/com/intellij/updater/CreateAction.java +++ b/updater/src/com/intellij/updater/CreateAction.java @@ -39,7 +39,7 @@ public class CreateAction extends PatchAction { ValidationResult result = doValidateAccess(toFile, ValidationResult.Action.CREATE); if (result != null) return result; - if (toFile.exists()) { + if (toFile.exists() && Runner.isPlatformCaseSensitive()) { ValidationResult.Option[] options = myPatch.isStrict() ? new ValidationResult.Option[]{ValidationResult.Option.REPLACE} : new ValidationResult.Option[]{ValidationResult.Option.REPLACE, ValidationResult.Option.KEEP}; diff --git a/updater/src/com/intellij/updater/Runner.java b/updater/src/com/intellij/updater/Runner.java index 6a109f137fce..91c6eed44f75 100644 --- a/updater/src/com/intellij/updater/Runner.java +++ b/updater/src/com/intellij/updater/Runner.java @@ -31,7 +31,8 @@ import java.util.zip.ZipInputStream; public class Runner { public static Logger logger = null; - + private static String updaterLogFileName; + private static boolean platformCaseSensitive; private static final String PATCH_FILE_NAME = "patch-file.zip"; public static void main(String[] args) throws Exception { @@ -46,6 +47,7 @@ public class Runner { String newFolder = args[4]; String patchFile = args[5]; initLogger(); + checkIfPlatformCaseSensitive(); // See usage for an explanation of these flags boolean binary = Arrays.asList(args).contains("--zip_as_binary"); @@ -83,6 +85,7 @@ public class Runner { else if (args.length >= 2 && ("install".equals(args[0]) || "apply".equals(args[0]))) { String destFolder = args[1]; initLogger(); + checkIfPlatformCaseSensitive(); logger.info("destFolder: " + destFolder); if ("install".equals(args[0])) { @@ -126,13 +129,24 @@ public class Runner { return dir; } + private static void checkIfPlatformCaseSensitive() throws Exception { + platformCaseSensitive = new File(updaterLogFileName.toLowerCase()).exists() && + new File(updaterLogFileName.toUpperCase()).exists() ? + false : true; + } + + public static boolean isPlatformCaseSensitive() { + return platformCaseSensitive; + } + public static void initLogger() { if (logger == null) { long requiredFreeSpace = 1000000; String logFolder = getDir(requiredFreeSpace); + updaterLogFileName = new File(logFolder, "idea_updater.log").getAbsolutePath(); FileAppender update = new FileAppender(); + update.setFile(updaterLogFileName); - update.setFile(new File(logFolder, "idea_updater.log").getAbsolutePath()); update.setLayout(new PatternLayout("%d{dd MMM yyyy HH:mm:ss} %-5p %C{1}.%M - %m%n")); update.setThreshold(Level.ALL); update.setAppend(true);