LIB: add createDir

This commit is contained in:
Julian Ospald 2015-12-26 15:58:41 +01:00
parent d727566e86
commit edb51ad1f6
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020

View File

@ -404,17 +404,20 @@ createFile _ ".." = return ()
createFile (SADir td) fn = do
let fullp = fullPath td </> fn
throwFileDoesExist fullp
let uf = unionFileModes
mode = ownerWriteMode
`uf` ownerReadMode
`uf` groupWriteMode
`uf` groupReadMode
`uf` otherWriteMode
`uf` otherReadMode
fd <- System.Posix.IO.createFile fullp mode
fd <- System.Posix.IO.createFile fullp newFilePerms
closeFd fd
createDir :: AnchoredFile FileInfo -> FileName -> IO ()
createDir _ "" = return ()
createDir _ "." = return ()
createDir _ ".." = return ()
createDir (SADir td) fn = do
let fullp = fullPath td </> fn
throwDirDoesExist fullp
createDirectory fullp newFilePerms
---------------------
@ -433,3 +436,29 @@ renameFile af fn = do
throwFileDoesExist tof
throwSameFile fromf tof
rename fromf tof
-----------------------
--[ File Permissions]--
-----------------------
newFilePerms :: FileMode
newFilePerms
= ownerWriteMode
`unionFileModes` ownerReadMode
`unionFileModes` groupWriteMode
`unionFileModes` groupReadMode
`unionFileModes` otherWriteMode
`unionFileModes` otherReadMode
newDirPerms :: FileMode
newDirPerms
= ownerModes
`unionFileModes` groupExecuteMode
`unionFileModes` groupReadMode
`unionFileModes` otherExecuteMode
`unionFileModes` otherReadMode