write_ok <- Posix.fileAccess name False True False
exec_ok <- Posix.fileAccess name False False True
stat <- Posix.getFileStatus name
- let is_dir = Posix.fileMode stat .&. Posix.directoryMode /= 0
+ let is_dir = Posix.isDirectory stat
return (
Permissions {
readable = read_ok,
else throw e
#else
stat <- Posix.getFileStatus dir
- if Posix.fileMode stat .&. Posix.directoryMode /= 0
+ if Posix.isDirectory stat
then return ()
else throw e
#endif
is_dir <- isDirectory st
#else
stat <- Posix.getSymbolicLinkStatus opath
- let is_dir = Posix.fileMode stat .&. Posix.directoryMode /= 0
+ let is_dir = Posix.isDirectory stat
#endif
if is_dir
then ioException (ioeSetErrorString
(withFileStatus "doesDirectoryExist" name $ \st -> isDirectory st)
#else
(do stat <- Posix.getFileStatus name
- return (Posix.fileMode stat .&. Posix.directoryMode /= 0))
+ return (Posix.isDirectory stat))
#endif
`catch` ((\ _ -> return False) :: IOException -> IO Bool)
(withFileStatus "doesFileExist" name $ \st -> do b <- isDirectory st; return (not b))
#else
(do stat <- Posix.getFileStatus name
- return (Posix.fileMode stat .&. Posix.directoryMode == 0))
+ return (not (Posix.isDirectory stat)))
#endif
`catch` ((\ _ -> return False) :: IOException -> IO Bool)