platform: check if restart is possible appcode/140.501 appcode/140.511 clion/140.494 clion/140.504 dbe/140.497 dbe/140.507 idea/140.499 idea/140.508 phpstorm/140.496 phpstorm/140.505 pycharm/140.500 pycharm/140.510 rubymine/140.495 rubymine/140.506 webstorm/140.498 webstorm/140.509
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Sat, 8 Nov 2014 15:38:26 +0000 (16:38 +0100)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Sat, 8 Nov 2014 15:38:26 +0000 (16:38 +0100)
platform/util/src/com/intellij/util/Restarter.java

index c69302b7244eb24c624da550acfd161b9c643d18..8ee6f46b10930ebb91f3b0c1762ade06efc12dcf 100644 (file)
@@ -53,7 +53,10 @@ public class Restarter {
   }
 
   public static boolean isSupported() {
-    return getRestartCode() != 0 || SystemInfo.isWindows || SystemInfo.isMac;
+    if (getRestartCode() != 0) return true;
+    if (SystemInfo.isWindows) return true;
+    if (SystemInfo.isMac) return PathManager.getHomePath().contains(".app");
+    return false;
   }
 
   public static int scheduleRestart(@NotNull String... beforeRestart) throws IOException {
@@ -147,7 +150,7 @@ public class Restarter {
     List<String> commands = new ArrayList<String>();
     commands.add(createTempExecutable(restarterFile).getPath());
     argumentsBuilder.consume(commands);
-    Runtime.getRuntime().exec(commands.toArray(new String[commands.size()]));
+    Runtime.getRuntime().exec(ArrayUtil.toStringArray(commands));
   }
 
   public static File createTempExecutable(File executable) throws IOException {
@@ -190,8 +193,7 @@ public class Restarter {
       try {
         StreamUtil.copyStreamContent(myIn, myOut);
       }
-      catch (IOException ignore) {
-      }
+      catch (IOException ignore) { }
     }
   }
 }
\ No newline at end of file