diff --git a/cocos2dx/platform/CCFileUtils.cpp b/cocos2dx/platform/CCFileUtils.cpp index e1a366096d..2de469e5e3 100644 --- a/cocos2dx/platform/CCFileUtils.cpp +++ b/cocos2dx/platform/CCFileUtils.cpp @@ -786,7 +786,14 @@ void FileUtils::loadFilenameLookupDictionaryFromFile(const char* filename) std::string FileUtils::getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename) { - std::string ret = strDirectory+strFilename; + // get directory+filename, safely adding '/' as necessary + std::string ret = strDirectory; + if (strDirectory.size() && strDirectory[strDirectory.size()-1] != '/'){ + ret += '/'; + } + ret += strFilename; + + // if the file doesn't exist, return an empty string if (!isFileExist(ret)) { ret = ""; }