LIB: fix file type indicators

It seems that PF.regularFileMode matches across symlinks and sockets
too, so we just examine the constructors instead.

Fixes #25
This commit is contained in:
Julian Ospald 2015-12-30 02:32:48 +01:00
parent 048bf8a328
commit 2bc406f65e
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020

View File

@ -784,14 +784,14 @@ packPermissions dt = fromFreeVar (pStr . fileMode) dt
where where
pStr ffm = typeModeStr ++ ownerModeStr ++ groupModeStr ++ otherModeStr pStr ffm = typeModeStr ++ ownerModeStr ++ groupModeStr ++ otherModeStr
where where
typeModeStr typeModeStr = case dt of
| hasFM PF.regularFileMode = "-" Dir {} -> "d"
| hasFM PF.directoryMode = "d" RegFile {} -> "-"
| hasFM PF.symbolicLinkMode = "l" SymLink {} -> "l"
| hasFM PF.socketMode = "s" BlockDev {} -> "b"
| hasFM PF.blockSpecialMode = "b" CharDev {} -> "c"
| hasFM PF.characterSpecialMode = "c" NamedPipe {} -> "p"
| hasFM PF.namedPipeMode = "p" Socket {} -> "s"
ownerModeStr = hasFmStr PF.ownerReadMode "r" ownerModeStr = hasFmStr PF.ownerReadMode "r"
++ hasFmStr PF.ownerWriteMode "w" ++ hasFmStr PF.ownerWriteMode "w"
++ hasFmStr PF.ownerExecuteMode "x" ++ hasFmStr PF.ownerExecuteMode "x"