mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Adds a systemCommand console utility function, which invokes the standard system() function call, and also has an optional callback return parameter.
This commit is contained in:
parent
2198dd14d1
commit
1496ffac6e
1 changed files with 18 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue