From 6d3615157accf2983929df355f4ee55838239329 Mon Sep 17 00:00:00 2001 From: minggo Date: Sat, 8 Jun 2013 13:40:03 +0800 Subject: [PATCH] fixed #2266:make CCFileUtil::getFileData() get data correctly --- cocos2dx/platform/android/CCFileUtilsAndroid.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cocos2dx/platform/android/CCFileUtilsAndroid.cpp b/cocos2dx/platform/android/CCFileUtilsAndroid.cpp index 2bcf2397ea..5340f61d78 100644 --- a/cocos2dx/platform/android/CCFileUtilsAndroid.cpp +++ b/cocos2dx/platform/android/CCFileUtilsAndroid.cpp @@ -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;