RE: copyFile function in Haddock, VSHaskell & Cabal

It might be worth lifting copyContents too; I've written this and I've seen it in hws-wp. I called it pipe, and in hws-wp it's called squirt. Perhaps something like this (untested!), in System.IO: hPipe :: Handle -> Handle -> Int -> IO () hPipe hFrom hTo bufferSize = do allocaBytes bufferSize bufferedPipe where bufferedPipe buffer = do count <- hGetBuf hFrom buffer bufferSize when (count > 0) $ do hPutBuf hTo buffer count bufferedPipe buffer
-----Original Message----- From: Krasimir Angelov [mailto:ka2_mail@yahoo.com] Sent: 29 July 2004 08:19 To: libraries@haskell.org Subject: copyFile function in Haddock, VSHaskell & Cabal
I have found a bug in CVS Haddock. It uses the following definition of copyFile function:
copyFile f = do s <- readFile (libdir ++ pathSeparator:f) writeFile (odir ++ pathSeparator:f) s
(See HaddockHtml.hs)
This works well for text files but the function fails when it is used to copy binary files under Windows. Similar functions are used also in VSHaskell and Cabal. I propose to add copyFile function to System.Directory which will take care of binary files. The function signature is simple:
copyFile :: FilePath -> FilePath -> IO ()
In the attached file there are two implementations. The first is a more portable but slower and the second is GHC specific but is faster.
Any suggestions Krasimir
----------------------------------------- ***************************************************************** Confidentiality Note: The information contained in this message, and any attachments, may contain confidential and/or privileged material. It is intended solely for the person(s) or entity to which it is addressed. Any review, retransmission, dissemination, or taking of any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you received this in error, please contact the sender and delete the material from any computer. *****************************************************************
participants (1)
-
Bayley, Alistair