use zlib to list directory structure of apk file in android

旧巷老猫 提交于 2019-12-07 12:16:24

问题


I am current working on an Android project.

Since the android apk file is essentially a zip file with a different file extension, is it possible to use zlib to file the directory structure of the asset folder?

The goal is to write some interfaces like opendir() and readdir() so that I can do something like:

DIR* dir = zip_opendir("somedirectory");
struct dirent* entry;
while (0 != (entry = zip_readdir(dir))){
    __android_log_print(ANDROID_LOG_ERROR, "DIR", "entry: %s\n", entry->d_name);
}

except that all the operations take place inside a zip file.


回答1:


You can use libzip (which itself uses zlib) to work with zip files. It does all you want and more.



来源:https://stackoverflow.com/questions/14563943/use-zlib-to-list-directory-structure-of-apk-file-in-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!