由于兼容性问题,我使用的是相当旧版本的 libzip (0.10.1-1.2)。
通常我们会通过统计结果检查文件类型(符号链接、目录、文件等)。类似地,在 libzip 上我们使用 zip_stat,但它的结构不包含文件系统 STAT 中的 ST_MOD 之类的任何内容。
struct zip_stat {
zip_uint64_t valid; /* which fields have valid values */
const char *name; /* name of the file */
zip_uint64_t index; /* index within archive */
zip_uint64_t size; /* size of file (uncompressed) */
zip_uint64_t comp_size; /* size of file (compressed) */
time_t mtime; /* modification time */
zip_uint32_t crc; /* crc of file data */
zip_uint16_t comp_method; /* compression method used */
zip_uint16_t encryption_method; /* encryption method used */
zip_uint32_t flags; /* reserved for future use */
};
有没有办法检查条目是否是 DIR?