1.在wax下lua文件下的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));
修改效果如下图所示
修改前的图片
修改后的图片









网友评论