ZVON > References > Haskell reference |
Intro / Search / ZVON |
| Indexes | Syntax | Prelude | Ratio | Complex | Numeric | Ix | Array | List | Maybe | Char | Monad | IO | >> Directory << | System | Time | Locale | CPUTime | Random |
Module: | Directory |
---|---|
Function: | setPermissions |
Type: | FilePath -> Permissions -> IO () |
Description: | The Permissions type is used to record whether certain operations are permissible on a file/directory. getPermissions and setPermissions get and set these permissions, respectively. Permissions apply both to files and directories. For directories, the executable field will be False, and for files the searchable field will be False. Note that directories may be searchable without being readable, if permission has been given to use them as part of a path, but not to examine the directory contents. |
Related: |
Program source: import IO import Directory main = do hdl <- openFile "/tmp/foo.txt" WriteMode hPutStr hdl "HELLO" hClose hdl a <- getPermissions "/tmp/foo.txt" print a setPermissions "/tmp/foo.txt" (Permissions False True False False) b <- getPermissions "/tmp/foo.txt" print b setPermissions "/tmp/foo.txt" b {readable=True} c <- getPermissions "/tmp/foo.txt" print c setPermissions "/tmp/foo.txt" c {readable=False, executable=True} d <- getPermissions "/tmp/foo.txt" print d
Output: Permissions{readable=True,writable=True,executable=False,searchable=False}
Output: Permissions{readable=False,writable=True,executable=False,searchable=False}
Output: Permissions{readable=True,writable=True,executable=False,searchable=False}
Output: Permissions{readable=False,writable=True,executable=True,searchable=False}