mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-CR-13343
This commit is contained in:
@@ -39,7 +39,7 @@ public class CreateAction extends PatchAction {
|
||||
ValidationResult result = doValidateAccess(toFile, ValidationResult.Action.CREATE);
|
||||
if (result != null) return result;
|
||||
|
||||
if (toFile.exists() && Runner.isPlatformCaseSensitive()) {
|
||||
if (toFile.exists()) {
|
||||
ValidationResult.Option[] options = myPatch.isStrict()
|
||||
? new ValidationResult.Option[]{ValidationResult.Option.REPLACE}
|
||||
: new ValidationResult.Option[]{ValidationResult.Option.REPLACE, ValidationResult.Option.KEEP};
|
||||
|
||||
@@ -264,12 +264,27 @@ public class Patch {
|
||||
myActions.add(0, new DeleteAction(this, file, Digester.INVALID));
|
||||
}
|
||||
}
|
||||
List<String> deleteElements = new ArrayList<>();
|
||||
Runner.logger.info("Validating installation...");
|
||||
forEach(myActions, "Validating installation...", ui, true,
|
||||
new ActionsProcessor() {
|
||||
@Override
|
||||
public void forEach(PatchAction each) throws IOException {
|
||||
String action = each.toString().toLowerCase();
|
||||
ValidationResult validationResult = each.validate(toDir);
|
||||
|
||||
if (action.startsWith("delete")) {
|
||||
deleteElements.add(each.getPath().toLowerCase());
|
||||
// create action + the same element was deleted + validated as already exists
|
||||
} else if (action.startsWith("create") &&
|
||||
(validationResult != null &&
|
||||
validationResult.message.equals(ValidationResult.ALREADY_EXISTS_MESSAGE))){
|
||||
for (String deleteElement : deleteElements) {
|
||||
if (each.getPath().toLowerCase().equals(deleteElement)) {
|
||||
validationResult = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (validationResult != null) result.add(validationResult);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.util.zip.ZipInputStream;
|
||||
|
||||
public class Runner {
|
||||
public static Logger logger = null;
|
||||
private static boolean platformCaseSensitive;
|
||||
private static final String PATCH_FILE_NAME = "patch-file.zip";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
@@ -46,7 +45,6 @@ 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");
|
||||
@@ -84,7 +82,6 @@ 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])) {
|
||||
@@ -128,18 +125,6 @@ public class Runner {
|
||||
return dir;
|
||||
}
|
||||
|
||||
private static void checkIfPlatformCaseSensitive() throws Exception {
|
||||
long requiredFreeSpace = 1000000;
|
||||
String logFolder = getDir(requiredFreeSpace);
|
||||
platformCaseSensitive = new File(logFolder.toLowerCase()).exists() &&
|
||||
new File(logFolder.toUpperCase()).exists() ?
|
||||
false : true;
|
||||
}
|
||||
|
||||
public static boolean isPlatformCaseSensitive() {
|
||||
return platformCaseSensitive;
|
||||
}
|
||||
|
||||
public static void initLogger() {
|
||||
if (logger == null) {
|
||||
long requiredFreeSpace = 1000000;
|
||||
|
||||
Reference in New Issue
Block a user