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

[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 '\\'

时间: 2024-08-07 17:00:53

[Cocos2dx Bug] [win32] Function CCFileUtils::fullPathFromRelativeFile forget consider the path separated by '\\'的相关文章

cocos2d-x 从win32到android移植的全套解决方案

引言:我们使用cocos2d-x引擎制作了一款飞行射击游戏,其中创新性地融入了手势识别功能.但是我们在移植过程中遇到了很多的问题,同时也发现网上的资料少而不全.所以在项目行将结束的时候,我们特地写了这篇文章来完整记录我们整个移植的过程,纪念我们项目的成功完成,更以此来表达对帮助过我们的人的感谢.移植过程中我们在网上得到了很多帮助,更要感谢黄杨学长在最后时刻帮助我们突破难关! 0.开发平台 系统:win8 profession 64bit IDE:vs2012 rtm, eclipse cocos

[AST Babel] Add function name into the console log 'path.findParent(t.isFunctionDeclaration)'

Continue with the previous post: https://www.cnblogs.com/Answer1215/p/12337243.html What we want to do in this post, is adding parent function name into the console log as well: Previous output is : function add(a, b) { console.log("2:4", a, b)

cocos2d-x的win32编译环境

1>     检查或配置VS 1.1>头文件 [c/c++]->附加包含目录 1.2>依赖库 [链接器]->[输入]->[附加依赖项] 2>     可能出现的错误 2.1>未关闭生成事件中的预链接事件 错误提示: C:\Program Files (x86)\MSBuild\Microsoft.Cpp \v4.0\V110\Microsoft.CppCommon.targets(129,5): error MSB3073: 命令“if not exist

cocos2dx创建win32项目一般步奏

1.导入一个新项目步奏:解决方案:右键->添加->添加现有项目->添加依赖项目libCocoStudioD:\work\CannonDefender\cocos2d\cocos\editor-support\cocostudio\proj.win32添加依赖项目libExtensionsD:\work\CannonDefender\cocos2d\extensions\proj.win32添加依赖项目libGUID:\work\CannonDefender\cocos2d\cocos\u

改良cocos2dx Win32下的内存占用

猜测它有可能是在主循环里使用了 Sleep(0), 一搜,果然定位到具体代码,它位于 cocos2dx\platform\win32\CCApplication.cpp,大致长像如下: 1 while( 1 ) { 2 if( 有消息 ) { 3 if( 时间到 ) 更新计时, call 主循环函数; 4 else Sleep(0); 5 } 6 // 其他跳出循环判断代码 7 } 也就是说,该循环除了执行 mainLoop 以外,花了大量时间在 检查消息和 Sleep(0) 上面. 并且,我还

COCOS2DX WIN32 版本的CPU占用25%改良策略

猜测它有可能是在主循环里使用了 Sleep(0), 一搜,果然定位到具体代码,它位于 cocos2dx\platform\win32\CCApplication.cpp,大致长像如下: 1 while( 1 ) { 2 if( 有消息 ) { 3 if( 时间到 ) 更新计时, call 主循环函数; 4 else Sleep(0); 5 } 6 // 其他跳出循环判断代码 7 } 也就是说,该循环除了执行 mainLoop 以外,花了大量时间在 检查消息和 Sleep(0) 上面. 并且,我还

cocos2d-x lua 中使用protobuf并对http进行处理

本文介绍 cocos2d-x lua 中使用http 和 基于cocos2d-x 对lua http的封装(部分ok) 本博客链接 http://blog.csdn.net/vpingchangxin/article/details/24458051 protobuf  Google的一个非常好用的数据传输的封装 说实话Google的东西确实比較好用 所以我们前后端数据交换就用他了 只是Google没有对lua进行支持 还好社区有开源的大侠们贡献 找了全部关于lua protobuf 我仅仅找到

cocos2dx Windows环境配置

cocos2dx升级之旅,请多指教~ 本篇是本人搭建cocos2dx-Windows 64位环境的配置说明,仅供参考. 开发准备 搭建环境肯定需要准备好所有工具,只有把工具都准备好了,才能撸起袖子干活,但是肯定被cocos官网提供的软件数目和分布的零散不堪的开发环境准备文档整的没有头绪.下面我们来理清一下思路. 1.python 2.7.X环境 cocos2dx的许多配置都是通过python来使用,因此万分紧急的是搭好python环境,而且cocos2d-x目前来说只支持到Py2.X版本(本人使

Cocos2d-x文件编译错误解决

编译出现的错误: 1>------ 已启动生成: 项目: HelloCpp, 配置: Debug Win32 ------ 1>生成启动时间为 2014/5/9 14:43:43. 1>InitializeBuildStatus: 1>  正在创建"Debug.win32\HelloCpp.unsuccessfulbuild",因为已指定"AlwaysCreate". 1>ClCompile: 1>  所有输出均为最新. 1>