static int Lwriter_add_file(lua_State *L) { mz_zip_archive *za = luaL_checkudata(L, 1, LMZ_ZIP_WRITER); const char* path = luaL_checkstring(L, 2); const char* filename = luaL_optstring(L, 3, path); mz_uint flags = (mz_uint)luaL_optinteger(L, 4, MZ_DEFAULT_LEVEL); size_t len; const char *comment = luaL_optlstring(L, 5, NULL, &len); if (!mz_zip_writer_add_file(za, path, filename, comment, (mz_uint16)len, flags)) return lmz_zip_pusherror(L, za, filename); return_self(L); }
bool ZipWriter::addFile(const Path &src, const Path &dst, int compressionLevel) { return mz_zip_writer_add_file(&_archive, dst.asString().c_str(), src.absolute().asString().c_str(), 0, 0, compressionLevel); }
bool ArchiveWriter::AddFile(const string& archive_name, const string& src_path) { mz_zip_archive* zip = (mz_zip_archive*)zip_obj_; return !!mz_zip_writer_add_file(zip, archive_name.c_str(), src_path.c_str(), NULL, 0, MZ_BEST_COMPRESSION); }