I use libzip to read APK content in native code.
assets/sounds/voice folder "disappeared" for libzip functions only.
libzip still see other files.assets/sounds/voice in project folder.clean many times.APK file from bin folder and I see all required files. (including files from assets/sounds/voice folder)I added small logging command and it does not print files from assets/sounds/voice folder. All other files are present.
int inum = zip_get_num_files(apkzip);
for(int i = 0; i < inum; i++){
const char * name = zip_get_name(apkzip, i, 0);
__android_log_print(ANDROID_LOG_INFO,"FILEZIP", "zip: %s", name);
}
I have no idea what at what step it is wrong. Had eclipse compressed ZPK with new format that my libzip does not able to read? or what could be a reason.
This is not an answer for libzip, but why you have to use libzip to read apk file in NDK application? In Android NDK, you can use AAsset APIs to get file from the apk. Take a look at "How To Get File In Assets From Android NDK".
EDITED
It is not available in android-5 that I still use
Ok. So how about Cocos2d-x's ZipFile? It is based on Minizip.
How to use ZipFile from cocos2dx/platform/android/CCFileUtilsAndroid.cpp
s_pZipFile = new ZipFile(resourcePath, "assets/");
pData = s_pZipFile->getFileData(fullPath.c_str(), pSize);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With