Skip to content

Commit

Permalink
Fix iOS build
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslo committed Feb 9, 2018
1 parent aa9ee04 commit 6477437
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/loslib.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,20 @@ static int os_pushresult (lua_State *L, int i, const char *filename) {


static int os_execute (lua_State *L) {
lua_pushinteger(L, system(luaL_optstring(L, 1, NULL)));
const char* s = luaL_optstring(L, 1, NULL);
int result;
#if defined(__APPLE__) && defined(__MACH__) && defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
// Not available since iOS SDK 11.0
if(s) {
result = -1;
}
else {
result = 0;
}
#else
result = system(s);
#endif
lua_pushinteger(L, result);
return 1;
}

Expand Down

0 comments on commit 6477437

Please sign in to comment.