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:
parent
048bf8a328
commit
2bc406f65e
@ -784,14 +784,14 @@ packPermissions dt = fromFreeVar (pStr . fileMode) dt
|
||||
where
|
||||
pStr ffm = typeModeStr ++ ownerModeStr ++ groupModeStr ++ otherModeStr
|
||||
where
|
||||
typeModeStr
|
||||
| hasFM PF.regularFileMode = "-"
|
||||
| hasFM PF.directoryMode = "d"
|
||||
| hasFM PF.symbolicLinkMode = "l"
|
||||
| hasFM PF.socketMode = "s"
|
||||
| hasFM PF.blockSpecialMode = "b"
|
||||
| hasFM PF.characterSpecialMode = "c"
|
||||
| hasFM PF.namedPipeMode = "p"
|
||||
typeModeStr = case dt of
|
||||
Dir {} -> "d"
|
||||
RegFile {} -> "-"
|
||||
SymLink {} -> "l"
|
||||
BlockDev {} -> "b"
|
||||
CharDev {} -> "c"
|
||||
NamedPipe {} -> "p"
|
||||
Socket {} -> "s"
|
||||
ownerModeStr = hasFmStr PF.ownerReadMode "r"
|
||||
++ hasFmStr PF.ownerWriteMode "w"
|
||||
++ hasFmStr PF.ownerExecuteMode "x"
|
||||
|
Loading…
Reference in New Issue
Block a user