[linux] CCFileUtils::isFileExistInternal should reject a folder (#19062)

* accept regular file only

* simplify code
This commit is contained in:
Arnold 2018-09-21 10:02:19 +08:00 committed by minggo
parent a6530a5aca
commit 6ea37d4c9d
1 changed files with 1 additions and 1 deletions

View File

@ -124,7 +124,7 @@ bool FileUtilsLinux::isFileExistInternal(const std::string& strFilePath) const
}
struct stat sts;
return (stat(strPath.c_str(), &sts) != -1) ? true : false;
return (stat(strPath.c_str(), &sts) == 0) && S_ISREG(sts.st_mode);
}
NS_CC_END