static int f_files (lua_State *L) { ZZIP_DIR *f = tofile(L, 1); zzip_rewinddir(f); lua_pushliteral(L, ZIPFILEHANDLE); lua_rawget(L, LUA_REGISTRYINDEX); lua_pushcclosure(L, zip_readfile, 2); return 1; }
void ArchiveZip::enumerate(Array<Path>& paths, bool dir) { if (!isValid || !handle) return; ZZIP_DIR* zip = (ZZIP_DIR*) handle; ZZIP_DIRENT entry; zzip_rewinddir(zip); while( zzip_dir_read(zip, &entry) != 0 ) { Path name = entry.d_name; bool isDir = !name.empty() && name[name.size()-1] == '/'; if( (dir && isDir) || (!dir && !isDir) ) paths.pushBack(name); } }