We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.
[win32] Passing empty string to FileUtils::isFileExist may also return true
[win32] Passing empty string to FileUtils::isFileExist may also return true
Bug #4711 [Closed]
Use this one.
WIN32_FILE_ATTRIBUTE_DATA data;
GET_FILEEX_INFO_LEVELS fInfoLevelId = GetFileExInfoStandard;
std::string s_str = string(pszPath);
std::wstring wid_str = std::wstring(s_str.begin(), s_str.end());
const wchar_t * xyz1 = wid_str.c_str();
GetFileAttributesEx(xyz1, fInfoLevelId, &data);
DWORD x = data.dwFileAttributes;
if ( x == 16 || x == 32)//16 for dir 32 for file
{
return true;
}
return false;
It's because
GetFileAttributesW
not only check whether file exists but also check directory exists.FIX IT BY