HPath.IO: small cleanup
This commit is contained in:
parent
613754c58f
commit
c76df7f159
@ -393,13 +393,13 @@ _copyFile :: [SPDF.Flags]
|
|||||||
-> IO ()
|
-> IO ()
|
||||||
_copyFile sflags dflags from to
|
_copyFile sflags dflags from to
|
||||||
=
|
=
|
||||||
-- TODO: add sendfile support
|
-- TODO: add sendfile support
|
||||||
withAbsPath to $ \to' -> withAbsPath from $ \from' ->
|
void $ readWriteCopy (fromAbs from) (fromAbs to)
|
||||||
void $ fallbackCopy from' to'
|
|
||||||
where
|
where
|
||||||
-- low-level copy operation utilizing read(2)/write(2)
|
-- low-level copy operation utilizing read(2)/write(2)
|
||||||
-- in case `sendFileCopy` fails/is unsupported
|
-- in case `sendFileCopy` fails/is unsupported
|
||||||
fallbackCopy source dest =
|
readWriteCopy :: ByteString -> ByteString -> IO Int
|
||||||
|
readWriteCopy source dest =
|
||||||
bracket (SPDT.openFd source SPI.ReadOnly sflags Nothing)
|
bracket (SPDT.openFd source SPI.ReadOnly sflags Nothing)
|
||||||
SPI.closeFd
|
SPI.closeFd
|
||||||
$ \sfd -> do
|
$ \sfd -> do
|
||||||
|
Loading…
Reference in New Issue
Block a user