Added ability to toggle on/off use of C system() function call, using OSG_SYSTEM_SUPPORTED Cmake option

This commit is contained in:
Robert Osfield
2018-01-12 19:52:31 +00:00
parent 6a3d9b2aa2
commit ae57f3cd46
10 changed files with 40 additions and 10 deletions

View File

@@ -19,6 +19,7 @@
#include "lauxlib.h"
#include "lualib.h"
#include <osg/Config>
/*
** list of valid conversion specifiers for the 'strftime' function
@@ -78,6 +79,8 @@
static int os_execute (lua_State *L) {
#if defined(OSG_SYSTEM_SUPPORTED)
const char *cmd = luaL_optstring(L, 1, NULL);
int stat = system(cmd);
if (cmd != NULL)
@@ -86,6 +89,9 @@ static int os_execute (lua_State *L) {
lua_pushboolean(L, stat); /* true if there is a shell */
return 1;
}
#else
return 0;
#endif
}