|
|
|
@ -765,25 +765,33 @@ 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());
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
// append arguments if any
|
|
|
|
|
if (!arguments.empty())
|
|
|
|
|
#ifdef NL_OS_MAC
|
|
|
|
|
// special OS X case with bundles
|
|
|
|
|
if (toLower(programName).find(".app") != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
command += NLMISC::toString(" --args %s", arguments.c_str());
|
|
|
|
|
}
|
|
|
|
|
// 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());
|
|
|
|
|
int res = system(command.c_str());
|
|
|
|
|
|
|
|
|
|
if (!res) return true;
|
|
|
|
|
if (!res) return true;
|
|
|
|
|
|
|
|
|
|
if (log)
|
|
|
|
|
{
|
|
|
|
|
nlwarning ("LAUNCH: Failed launched '%s' with arg '%s' return code %d", programName.c_str(), arguments.c_str(), res);
|
|
|
|
|
if (log)
|
|
|
|
|
{
|
|
|
|
|
nlwarning ("LAUNCH: Failed launched '%s' with arg '%s' return code %d", programName.c_str(), arguments.c_str(), res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static bool firstLaunchProgram = true;
|
|
|
|
|
if (firstLaunchProgram)
|
|
|
|
|