Make createRegularFile and createDir accept FileMode parameter
This commit is contained in:
parent
16af98b32d
commit
92017ab630
@ -661,9 +661,9 @@ executeFile fp args
|
|||||||
--
|
--
|
||||||
-- - `PermissionDenied` if output directory cannot be written to
|
-- - `PermissionDenied` if output directory cannot be written to
|
||||||
-- - `AlreadyExists` if destination file already exists
|
-- - `AlreadyExists` if destination file already exists
|
||||||
createRegularFile :: Path Abs -> IO ()
|
createRegularFile :: FileMode -> Path Abs -> IO ()
|
||||||
createRegularFile dest =
|
createRegularFile fm dest =
|
||||||
bracket (SPI.openFd (fromAbs dest) SPI.WriteOnly (Just newFilePerms)
|
bracket (SPI.openFd (fromAbs dest) SPI.WriteOnly (Just fm)
|
||||||
(SPI.defaultFileFlags { exclusive = True }))
|
(SPI.defaultFileFlags { exclusive = True }))
|
||||||
SPI.closeFd
|
SPI.closeFd
|
||||||
(\_ -> return ())
|
(\_ -> return ())
|
||||||
@ -675,8 +675,8 @@ createRegularFile dest =
|
|||||||
--
|
--
|
||||||
-- - `PermissionDenied` if output directory cannot be written to
|
-- - `PermissionDenied` if output directory cannot be written to
|
||||||
-- - `AlreadyExists` if destination directory already exists
|
-- - `AlreadyExists` if destination directory already exists
|
||||||
createDir :: Path Abs -> IO ()
|
createDir :: FileMode -> Path Abs -> IO ()
|
||||||
createDir dest = createDirectory (fromAbs dest) newDirPerms
|
createDir fm dest = createDirectory (fromAbs dest) fm
|
||||||
|
|
||||||
|
|
||||||
-- |Create a symlink.
|
-- |Create a symlink.
|
||||||
|
@ -86,7 +86,7 @@ createTmpDir :: IO ()
|
|||||||
createTmpDir = do
|
createTmpDir = do
|
||||||
pwd <- fromJust <$> getEnv "PWD" >>= P.parseAbs
|
pwd <- fromJust <$> getEnv "PWD" >>= P.parseAbs
|
||||||
tmp <- P.parseRel =<< readIORef tmpDir
|
tmp <- P.parseRel =<< readIORef tmpDir
|
||||||
void $ createDir (pwd P.</> tmp)
|
void $ createDir newDirPerms (pwd P.</> tmp)
|
||||||
|
|
||||||
|
|
||||||
deleteTmpDir :: IO ()
|
deleteTmpDir :: IO ()
|
||||||
@ -102,7 +102,7 @@ createBaseTmpDir :: IO ()
|
|||||||
createBaseTmpDir = do
|
createBaseTmpDir = do
|
||||||
pwd <- fromJust <$> getEnv "PWD" >>= P.parseAbs
|
pwd <- fromJust <$> getEnv "PWD" >>= P.parseAbs
|
||||||
tmp <- P.parseRel baseTmpDir
|
tmp <- P.parseRel baseTmpDir
|
||||||
void $ createDir (pwd P.</> tmp)
|
void $ createDir newDirPerms (pwd P.</> tmp)
|
||||||
|
|
||||||
|
|
||||||
deleteBaseTmpDir :: IO ()
|
deleteBaseTmpDir :: IO ()
|
||||||
@ -177,12 +177,12 @@ copyDirRecursive' inputDirP outputDirP cm rm =
|
|||||||
|
|
||||||
createDir' :: ByteString -> IO ()
|
createDir' :: ByteString -> IO ()
|
||||||
{-# NOINLINE createDir' #-}
|
{-# NOINLINE createDir' #-}
|
||||||
createDir' dest = withTmpDir dest createDir
|
createDir' dest = withTmpDir dest (createDir newDirPerms)
|
||||||
|
|
||||||
|
|
||||||
createRegularFile' :: ByteString -> IO ()
|
createRegularFile' :: ByteString -> IO ()
|
||||||
{-# NOINLINE createRegularFile' #-}
|
{-# NOINLINE createRegularFile' #-}
|
||||||
createRegularFile' dest = withTmpDir dest createRegularFile
|
createRegularFile' dest = withTmpDir dest (createRegularFile newFilePerms)
|
||||||
|
|
||||||
|
|
||||||
createSymlink' :: ByteString -> ByteString -> IO ()
|
createSymlink' :: ByteString -> ByteString -> IO ()
|
||||||
|
Loading…
Reference in New Issue
Block a user