Cleanup (sane diagnostic message)
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Sat, 8 Nov 2014 15:30:50 +0000 (16:30 +0100)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Sat, 8 Nov 2014 15:30:50 +0000 (16:30 +0100)
platform/util/src/com/intellij/util/Restarter.java

index 679ef27a990f315434d51444cd055ffb23c995ef..c69302b7244eb24c624da550acfd161b9c643d18 100644 (file)
@@ -129,13 +129,15 @@ public class Restarter {
   }
 
   private static void restartOnMac(@NotNull final String... beforeRestart) throws IOException {
   }
 
   private static void restartOnMac(@NotNull final String... beforeRestart) throws IOException {
-    final String homePath = PathManager.getHomePath().substring(0, PathManager.getHomePath().indexOf( ".app" ) + 4);
-    if (!StringUtil.endsWithIgnoreCase(homePath, ".app")) throw new IOException("Application bundle not found: " + homePath);
+    String homePath = PathManager.getHomePath();
+    int p = homePath.indexOf(".app");
+    if (p < 0) throw new IOException("Application bundle not found: " + homePath);
 
 
+    final String bundlePath = homePath.substring(0, p + 4);
     doScheduleRestart(new File(PathManager.getBinPath(), "restarter"), new Consumer<List<String>>() {
       @Override
       public void consume(List<String> commands) {
     doScheduleRestart(new File(PathManager.getBinPath(), "restarter"), new Consumer<List<String>>() {
       @Override
       public void consume(List<String> commands) {
-        Collections.addAll(commands, homePath);
+        Collections.addAll(commands, bundlePath);
         Collections.addAll(commands, beforeRestart);
       }
     });
         Collections.addAll(commands, beforeRestart);
       }
     });