windows 平台
问题概率 100%
cocos creator:
void FileUtils::listFilesRecursively(const std::string& dirPath, std::vector<std::string> *files) const
{
std::string fullpath = fullPathForFilename(dirPath);
if (isDirectoryExist(fullpath))
{
tinydir_dir dir;
#ifdef UNICODE
此处 如果路径中存在中文 则获取出来的长度和 fullpath.size 不一致 然后直接return 倒是获取文件列表失败
unsigned int length = MultiByteToWideChar(CP_UTF8, 0, &fullpath[0], (int)fullpath.size(), NULL, 0);
本来就是为了获取真实的长度 然后写入到fullpathstr 不能应该return
if (length != fullpath.size())
{
return;
}
std::wstring fullpathstr(length, 0);
MultiByteToWideChar(CP_UTF8, 0, &fullpath[0], (int)fullpath.size(), &fullpathstr[0], length);
#else
std::string fullpathstr = fullpath;
#endif
。。。。。。。。