copyFile function in Haddock, VSHaskell & Cabal
Simon Marlow
simonmar at microsoft.com
Thu Jul 29 05:59:33 EDT 2004
On 29 July 2004 08:19, Krasimir Angelov wrote:
> 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.
We have a copyFile function in DirectoryExts (hslibs/lang). I've been
meaning to move this over to System.Directory for some time. Your
version looks fine - please go ahead!
Cheers,
Simon
More information about the Libraries
mailing list