From fc69d4cec90e2553921f3b968508e1d31253ee54 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 13 Feb 2016 23:30:00 +0100 Subject: [PATCH] Changed: Use same code as under Linux for OS X when executing sheel scripts --HG-- branch : develop --- code/nel/src/misc/common.cpp | 44 +++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index b40734b73..c2c762ea0 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -765,26 +765,34 @@ bool launchProgram(const std::string &programName, const std::string &arguments, CloseHandle( pi.hThread ); } -#elif defined(NL_OS_MAC) - // we need to open bundles with "open" command - std::string command = NLMISC::toString("open \"%s\"", programName.c_str()); - - // append arguments if any - if (!arguments.empty()) - { - command += NLMISC::toString(" --args %s", arguments.c_str()); - } - - int res = system(command.c_str()); - - if (!res) return true; - - if (log) - { - nlwarning ("LAUNCH: Failed launched '%s' with arg '%s' return code %d", programName.c_str(), arguments.c_str(), res); - } #else +#ifdef NL_OS_MAC + // special OS X case with bundles + if (toLower(programName).find(".app") != std::string::npos) + { + // we need to open bundles with "open" command + std::string command = NLMISC::toString("open \"%s\"", programName.c_str()); + + // append arguments if any + if (!arguments.empty()) + { + command += NLMISC::toString(" --args %s", arguments.c_str()); + } + + int res = system(command.c_str()); + + if (!res) return true; + + if (log) + { + nlwarning ("LAUNCH: Failed launched '%s' with arg '%s' return code %d", programName.c_str(), arguments.c_str(), res); + } + + return false; + } +#endif + static bool firstLaunchProgram = true; if (firstLaunchProgram) {