From f71df5a87339db0f945ea9eb350ccf819b9e94fe Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 25 Jan 2013 23:01:47 +0800 Subject: [PATCH] Fixed an issue in CCFileUtils::setResourceDirectory for android. --- cocos2dx/platform/android/CCFileUtils.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cocos2dx/platform/android/CCFileUtils.cpp b/cocos2dx/platform/android/CCFileUtils.cpp index d3c07ebf9a..f69926d769 100644 --- a/cocos2dx/platform/android/CCFileUtils.cpp +++ b/cocos2dx/platform/android/CCFileUtils.cpp @@ -236,12 +236,18 @@ unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* psz void CCFileUtils::setResourceDirectory(const char* pszResourceDirectory) { + if (pszResourceDirectory == NULL) return; + m_obDirectory = pszResourceDirectory; if (m_obDirectory.size() > 0 && m_obDirectory[m_obDirectory.size() - 1] != '/') { m_obDirectory.append("/"); } - m_obDirectory += "assets/"; + if (pszResourceDirectory[0] != '/') + { + m_obDirectory.insert(0, "assets/"); + } + m_pSearchPathArray->insertObject(CCString::create(m_obDirectory.c_str()), 0); }