I can run this code to get ZipFile Content below in ios.
unsigned long s;
const char* p = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(“Test.zip”);
unsigned char* zipData = CCFileUtils::sharedFileUtils()->getFileDataFromZip(p, “Test.txt”,&s);
CCLog(“getFileDataFromZip s size:d content:s ",p, s,zipData);
These out info.
getFileDataFromZip /var/mobile/Applications/XXXXX-XXX-XXX-XXX-XXXXXXX/XXXXXX.app/Test.zip size:3 content:123
But I use the same code in android
and put Test.zip into asset(No extra folder),
I can’t get any data.
And I try to use getFileDat to test,It’s fine. I can get correct size.
const char* zipData = CCFileUtils::sharedFileUtils()->getFileData(“Test.zip”,“rb”, &s);
CCLog("getFileData d”,s);
How to fix that getFileDataFromZip issue in android?
Thanks. Regards.
Ok. My fault. Because it can not contain .gz file.
.apk is already a zip file. CCFileUtils::sharedFileUtils()->getFileDataFromZip(p, “Test.txt”,&s) will just read “Test.txt” from .apk. It will not read “Test.txt” from Text.zip.