aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/fs/FileInfo.hxx3
-rw-r--r--src/fs/FileSystem.hxx3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/fs/FileInfo.hxx b/src/fs/FileInfo.hxx
index ad0fb4064..7b272568f 100644
--- a/src/fs/FileInfo.hxx
+++ b/src/fs/FileInfo.hxx
@@ -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
diff --git a/src/fs/FileSystem.hxx b/src/fs/FileSystem.hxx
index a6240bf0e..309c0cdf6 100644
--- a/src/fs/FileSystem.hxx
+++ b/src/fs/FileSystem.hxx
@@ -152,7 +152,8 @@ FileExists(Path path, bool follow_symlinks = true)
(void)follow_symlinks;
const auto a = GetFileAttributes(path.c_str());
- return a != INVALID_FILE_ATTRIBUTES && (a & FILE_ATTRIBUTE_NORMAL);
+ return a != INVALID_FILE_ATTRIBUTES &&
+ (a & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_DEVICE)) == 0;
#else
struct stat buf;
return StatFile(path, buf, follow_symlinks) && S_ISREG(buf.st_mode);