ZVON > References > Haskell reference
| 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:

Example 1
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}




_____________________________________________
Reference Search | Sitemap | XML Glossary       ZVON | Systinet




Related sites:
  • dotNet Slackers - Your latest resource for ASP.NET
  • Dotnet Spider - Outsourcing and Offshore software development in India
  • XML - Xselerator, XSL Editor, BizTalk Utilities, XML Tutorials, Learn XML
  • Planet Source Code - The largest public source code database on the Internet
Domain Names VoIP Internettelefonie DSL, SDSL, ADSL UNLIMITED Web Hosting by HostDepartment conference call service
answering service