Skip to content

Commit 6ea37d4

Browse files
PatriceJiangminggo
authored andcommitted
[linux] CCFileUtils::isFileExistInternal should reject a folder (cocos2d#19062)
* accept regular file only * simplify code
1 parent a6530a5 commit 6ea37d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cocos/platform/linux/CCFileUtils-linux.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ bool FileUtilsLinux::isFileExistInternal(const std::string& strFilePath) const
124124
}
125125

126126
struct stat sts;
127-
return (stat(strPath.c_str(), &sts) != -1) ? true : false;
127+
return (stat(strPath.c_str(), &sts) == 0) && S_ISREG(sts.st_mode);
128128
}
129129

130130
NS_CC_END

0 commit comments

Comments
 (0)