From 991df2761b644883210383fc5dac8f04c235a808 Mon Sep 17 00:00:00 2001 From: Roman Chernyatchik Date: Mon, 21 Feb 2011 21:10:10 +0300 Subject: [PATCH] cmdline launcher should use "open -a" cmd on MacOS, otherwise at least 32/64 bit mode setting wont be correct. --- .../ide/actions/CreateLauncherScriptAction.java | 3 ++- platform/platform-resources/src/launcher.py | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/actions/CreateLauncherScriptAction.java b/platform/platform-impl/src/com/intellij/ide/actions/CreateLauncherScriptAction.java index c4091286e937..223f1a11a8ef 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/CreateLauncherScriptAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/CreateLauncherScriptAction.java @@ -137,7 +137,8 @@ public class CreateLauncherScriptAction extends AnAction { String homePath = PathManager.getHomePath(); String productName = ApplicationNamesInfo.getInstance().getProductName().toLowerCase(); if (SystemInfo.isMac) { - launcherContents = launcherContents.replace("$RUN_PATH$", homePath + "/Contents/MacOS/" + productName); + // Just use "*.app" + launcherContents = launcherContents.replace("$RUN_PATH$", homePath); } else { launcherContents = launcherContents.replace("$RUN_PATH$", homePath + "/bin/" + productName + ".sh"); diff --git a/platform/platform-resources/src/launcher.py b/platform/platform-resources/src/launcher.py index 0bcc36326934..79183be49cef 100644 --- a/platform/platform-resources/src/launcher.py +++ b/platform/platform-resources/src/launcher.py @@ -69,6 +69,13 @@ if port == -1: else: if launch_with_port(port): exit() -bin_dir, bin_file = os.path.split(RUN_PATH) -os.chdir(bin_dir) -os.execv(bin_file, [bin_file] + args) +if sys.platform == "darwin": + # Mac OS: RUN_PATH is *.app path + if len(args): + args.insert(0, "--args") + os.execvp("open", ["-a", RUN_PATH] + args) +else: + # unix common + bin_dir, bin_file = os.path.split(RUN_PATH) + os.chdir(bin_dir) + os.execv(bin_file, [bin_file] + args)