X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FDirectory.hs;fp=System%2FDirectory.hs;h=2f3cb258541f5a0e8e073ea2db8b730a51ca6678;hb=8f70256c2e54e21df085786b69a8e74901aad7f2;hp=bd05bad4ec7f6357ab99b89f60bee0ded2a958c0;hpb=277a9e46ab403722488b4bee7958751195fe012d;p=haskell-directory.git diff --git a/System/Directory.hs b/System/Directory.hs index bd05bad..2f3cb25 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -203,7 +203,7 @@ getPermissions name = do 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, @@ -373,7 +373,7 @@ createDirectoryIfMissing create_parents path0 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 @@ -618,7 +618,7 @@ renameFile opath npath = do 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 @@ -898,7 +898,7 @@ doesDirectoryExist name = (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) @@ -912,7 +912,7 @@ doesFileExist name = (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)