fixed #2266:make CCFileUtil::getFileData() get data correctly

This commit is contained in:
minggo 2013-06-08 13:40:03 +08:00
parent 206502dccb
commit 6d3615157a
1 changed files with 4 additions and 3 deletions

View File

@ -118,10 +118,11 @@ unsigned char* CCFileUtilsAndroid::getFileData(const char* pszFileName, const ch
return 0;
}
if (pszFileName[0] != '/')
string fullPath = fullPathForFilename(pszFileName);
if (fullPath[0] != '/')
{
//CCLOG("GETTING FILE RELATIVE DATA: %s", pszFileName);
string fullPath = fullPathForFilename(pszFileName);
pData = s_pZipFile->getFileData(fullPath.c_str(), pSize);
}
else
@ -130,7 +131,7 @@ unsigned char* CCFileUtilsAndroid::getFileData(const char* pszFileName, const ch
{
// read rrom other path than user set it
//CCLOG("GETTING FILE ABSOLUTE DATA: %s", pszFileName);
FILE *fp = fopen(pszFileName, pszMode);
FILE *fp = fopen(fullPath.c_str(), pszMode);
CC_BREAK_IF(!fp);
unsigned long size;