iOS 使用wax报错'system' is unavailab

2019-10-24  本文已影响0人  卤蛋两枚

1.在waxlua文件下的loslib.c文件 #include <ftw.h>
2.增加unlink_cb方法

int unlink_cb(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf)
{
       int rv = remove(fpath);

       if (rv)
       perror(fpath);

       return rv;
}

3.更改system方法为nftw方法

lua_pushinteger(L, system(luaL_optstring(L, 1, NULL)));
改成
lua_pushinteger(L, nftw(luaL_optstring(L, 1, NULL), unlink_cb, 64, FTW_DEPTH | FTW_PHYS));

修改效果如下图所示

修改前的图片 修改后的图片
上一篇 下一篇

猜你喜欢

热点阅读