Merge pull request #12709 from WenhaiLin/v3-37-crash-winfix

Fixed crash cause by the case of file name on WIN32.
This commit is contained in:
子龙山人 2015-07-07 13:42:01 +08:00
commit a41d3847d5
1 changed files with 3 additions and 4 deletions

View File

@ -159,10 +159,9 @@ static bool checkFileName(const std::string& fullPath, const std::string& filena
std::string msg = "File path error: \"";
msg.append(filename).append("\" the real name is: ").append(realName);
CCLOG("%s", msg.c_str());
log("%s", msg.c_str());
return false;
}
}
else
{
@ -193,7 +192,7 @@ static Data getData(const std::string& filename, bool forString)
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filename);
// check if the filename uses correct case characters
CC_BREAK_IF(!checkFileName(fullPath, filename));
checkFileName(fullPath, filename);
WCHAR wszBuf[CC_MAX_PATH] = {0};
MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0]));
@ -278,7 +277,7 @@ unsigned char* FileUtilsWin32::getFileData(const std::string& filename, const ch
std::string fullPath = fullPathForFilename(filename);
// check if the filename uses correct case characters
CC_BREAK_IF(!checkFileName(fullPath, filename));
checkFileName(fullPath, filename);
WCHAR wszBuf[CC_MAX_PATH] = {0};
MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0]));