mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Merge pull request #741 from Areloch/systemCommandFunction
Adds a systemCommand console utility function
This commit is contained in:
commit
dad0149dfe
|
|
@ -2859,3 +2859,21 @@ DefineEngineFunction(getTimestamp, const char*, (), ,
|
|||
|
||||
return returnBuffer;
|
||||
}
|
||||
|
||||
#ifdef TORQUE_TOOLS
|
||||
DefineEngineFunction(systemCommand, S32, (const char* commandLineAction, const char* callBackFunction), , "", "")
|
||||
{
|
||||
if (commandLineAction != "")
|
||||
{
|
||||
S32 result = system(commandLineAction);
|
||||
|
||||
if (callBackFunction != "" && callBackFunction[0])
|
||||
{
|
||||
if (Con::isFunction(callBackFunction))
|
||||
Con::executef(callBackFunction, result);
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue