diff --git a/Core/FileSystems/DirectoryFileSystem.cpp b/Core/FileSystems/DirectoryFileSystem.cpp index c0799dcd73..4c0fd6f542 100644 --- a/Core/FileSystems/DirectoryFileSystem.cpp +++ b/Core/FileSystems/DirectoryFileSystem.cpp @@ -218,6 +218,7 @@ bool DirectoryFileHandle::Open(std::string& basePath, std::string& fileName, Fil hFile = open(fullName.c_str(), flags, 0666); bool success = hFile != -1; + #endif #if HOST_IS_CASE_SENSITIVE @@ -240,6 +241,17 @@ bool DirectoryFileHandle::Open(std::string& basePath, std::string& fileName, Fil } #endif +#ifndef _WIN32 + if (success) { + struct stat st; + if (fstat(hFile, &st) == 0 && S_ISDIR(st.st_mode)) { + close(hFile); + errno = EISDIR; + success = false; + } + } +#endif + return success; }