mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-17 21:11:39 +00:00
Fixed: Implement launch of executables under OS X
This commit is contained in:
parent
7b9050d439
commit
c20346238a
1 changed files with 24 additions and 4 deletions
|
@ -728,7 +728,30 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
||||||
CloseHandle( pi.hThread );
|
CloseHandle( pi.hThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(NL_OS_UNIX)
|
#elif defined(NL_OS_MAC)
|
||||||
|
std::string command;
|
||||||
|
|
||||||
|
if (CFile::getExtension(programName) == "app")
|
||||||
|
{
|
||||||
|
// we need to open bundles with "open" command
|
||||||
|
command = NLMISC::toString("open \"%s\"", programName.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
command = programName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// append arguments if any
|
||||||
|
if (!arguments.empty())
|
||||||
|
{
|
||||||
|
command += NLMISC::toString(" --args %s", arguments.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
int res = system(command.c_str());
|
||||||
|
|
||||||
|
if (res && log)
|
||||||
|
nlwarning ("LAUNCH: Failed launched '%s' with arg '%s' return code %d", programName.c_str(), arguments.c_str(), res);
|
||||||
|
#else
|
||||||
|
|
||||||
static bool firstLaunchProgram = true;
|
static bool firstLaunchProgram = true;
|
||||||
if (firstLaunchProgram)
|
if (firstLaunchProgram)
|
||||||
|
@ -811,9 +834,6 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (log)
|
|
||||||
nlwarning ("LAUNCH: launchProgram() not implemented");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue