From 3ee08a0aa1af7c1ad883e2a02e8dd030a4737404 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 8 Sep 2016 12:39:17 +0300 Subject: [PATCH] [platform] allows an easier manual patch application (IDEA-CR-13552) --- .../openapi/updateSettings/impl/UpdateInfoDialog.java | 11 +++++++---- .../src/messages/IdeBundle.properties | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java index 0a1752574f86..28b1dc78f93f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java @@ -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); diff --git a/platform/platform-resources-en/src/messages/IdeBundle.properties b/platform/platform-resources-en/src/messages/IdeBundle.properties index 7dc329625b60..b4586011bc86 100644 --- a/platform/platform-resources-en/src/messages/IdeBundle.properties +++ b/platform/platform-resources-en/src/messages/IdeBundle.properties @@ -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 settings 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