[platform] allows an easier manual patch application (IDEA-CR-13552)

This commit is contained in:
Roman Shevchenko
2016-09-08 12:42:19 +03:00
parent 419d99630a
commit 3ee08a0aa1
2 changed files with 8 additions and 5 deletions
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.updateSettings.impl;
import com.intellij.execution.CommandLineUtil;
import com.intellij.ide.BrowserUtil;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
@@ -33,6 +34,7 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.BrowserHyperlinkListener;
@@ -52,11 +54,10 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.File;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.intellij.openapi.util.Pair.pair;
@@ -238,10 +239,12 @@ class UpdateInfoDialog extends AbstractUpdateDialog {
private static void showPatchInstructions(String[] command) {
String product = ApplicationNamesInfo.getInstance().getLowercaseProductName();
String version = ApplicationInfo.getInstance().getFullVersion();
File file = new File(SystemProperties.getUserHome(), product + "-" + version + "-patch.txt");
File file = new File(SystemProperties.getUserHome(), product + "-" + version + "-patch." + (SystemInfo.isWindows ? "cmd" : "sh"));
try {
String text = Stream.of(command).map(s -> s.indexOf(' ') > 0 ? '"' + s + '"' : s).collect(Collectors.joining(" "));
String text = (SystemInfo.isWindows ? "@echo off\n\n" : "#!/bin/sh\n\n") +
StringUtil.join(CommandLineUtil.toCommandLine(Arrays.asList(command)), " ");
FileUtil.writeToFile(file, text);
FileUtil.setExecutableAttribute(file.getPath(), true);
}
catch (Exception e) {
Logger.getInstance(UpdateInstaller.class).error(e);
@@ -968,7 +968,7 @@ update.sni.disabled.message=We wanted your IDE to receive upgrades over a secure
Unfortunately, this doesn't work with the 'jsse.enableSNIExtension' property set to 'false', so the option was disabled. \
You can enable it again in <a href="disable">settings</a> after setting the property to 'true'.
update.apply.manually.message=Unfortunately, the IDE is not capable of an automatic update on your system.\n \
Please quit the IDE and apply the patch manually by invoking a command from this file:\n{0}.
Please quit the IDE and apply the patch manually by launching this script:\n{0}.
hierarchy.method.next.occurence.name=Go to next method
hierarchy.method.prev.occurence.name=Go to previous method