码迷,mamicode.com
首页 > Windows程序 > 详细

[Cocos2dx Bug] [win32] Function CCFileUtils::fullPathFromRelativeFile forget consider the path separated by '\\'

时间:2014-11-26 22:22:08      阅读:302      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   ar   color   os   sp   for   on   

[Cocos2dx 2.2.4]

[win32平台Bug]

const char* CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile)

方法中,没有考虑windows下的 path separated is ‘\\‘

源码:

1 const char* CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile)
2 {
3     std::string relativeFile = pszRelativeFile;
4     CCString *pRet = CCString::create("");
5     pRet->m_sString = relativeFile.substr(0, relativeFile.rfind(/) + 1);
6     pRet->m_sString += getNewFilename(pszFilename);
7     return pRet->getCString();
8 }

修改为:

 1 const char* CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile)
 2 {
 3     std::string relativeFile = pszRelativeFile;
 4     CCString *pRet = CCString::create("");
 5 #if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
 6     pRet->m_sString = relativeFile.substr(0, relativeFile.rfind(\\) + 1);
 7 #else
 8     pRet->m_sString = relativeFile.substr(0, relativeFile.rfind(/) + 1);
 9 #endif
10     pRet->m_sString += getNewFilename(pszFilename);
11     return pRet->getCString();
12 }

 

[Cocos2dx Bug] [win32] Function CCFileUtils::fullPathFromRelativeFile forget consider the path separated by '\\'

标签:style   blog   io   ar   color   os   sp   for   on   

原文地址:http://www.cnblogs.com/StanBlogs/p/4124855.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!