fs/File{System,Info}: fix regular file check
Don't use FILE_ATTRIBUTE_NORMAL, it's a "magic" value for something else. To check if a file is a regular file, we need to check if it's NOT a directory (or a device).
This commit is contained in:
@@ -65,7 +65,8 @@ class FileInfo {
|
||||
public:
|
||||
bool IsRegular() const {
|
||||
#ifdef WIN32
|
||||
return data.dwFileAttributes & FILE_ATTRIBUTE_NORMAL;
|
||||
return (data.dwFileAttributes &
|
||||
(FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_DEVICE)) == 0;
|
||||
#else
|
||||
return S_ISREG(st.st_mode);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user