mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 09:36:15 +00:00
Changed: Updated launchProgramAndWaitForResult to support .bat files
--HG-- branch : develop
This commit is contained in:
parent
3e02d29050
commit
6a7c33fa32
1 changed files with 16 additions and 2 deletions
|
@ -878,8 +878,22 @@ sint launchProgramAndWaitForResult(const std::string &programName, const std::st
|
||||||
SetEnvironmentVariable( SE_TRANSLATOR_IN_MAIN_MODULE, NULL );
|
SetEnvironmentVariable( SE_TRANSLATOR_IN_MAIN_MODULE, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
string arg = " " + arguments;
|
const char *sProgramName = programName.c_str();
|
||||||
BOOL ok = CreateProcessA(programName.c_str(), (char*)arg.c_str(), NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, NULL, NULL, &si, &pi);
|
|
||||||
|
std::string args;
|
||||||
|
|
||||||
|
// a .bat file must have first parameter to NULL and use 2nd parameter to pass filename
|
||||||
|
if (CFile::getExtension(programName) == "bat")
|
||||||
|
{
|
||||||
|
sProgramName = NULL;
|
||||||
|
args = "\"" + programName + "\" " + arguments;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
args = arguments;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL ok = CreateProcessA(sProgramName, (char*)args.c_str(), NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, NULL, NULL, &si, &pi);
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue