diff --git a/cocos/2d/platform/apple/CCFileUtilsApple.mm b/cocos/2d/platform/apple/CCFileUtilsApple.mm index 9c9443e0f7..c2d32600de 100644 --- a/cocos/2d/platform/apple/CCFileUtilsApple.mm +++ b/cocos/2d/platform/apple/CCFileUtilsApple.mm @@ -302,7 +302,11 @@ std::string FileUtilsApple::getFullPathForDirectoryAndFilename(const std::string } else { - std::string fullPath = directory+filename; + std::string fullPath = directory; + if (!directory.empty() && directory[directory.length()-1] != '/') + fullPath.append("/"); + + fullPath.append(filename); // Search path is an absolute path. if ([s_fileManager fileExistsAtPath:[NSString stringWithUTF8String:fullPath.c_str()]]) { return fullPath;