From: Malcolm.Wallace@cs.york.ac.uk Date: Sat, 4 Aug 2007 09:28:15 +0000 (+0000) Subject: Restore working version of copyFile for nhc98. X-Git-Tag: 2007-09-13~3 X-Git-Url: http://git.megacz.com/?p=haskell-directory.git;a=commitdiff_plain;h=933bc96e88506ef6f8953ee71b3b3c8d53e7eed5 Restore working version of copyFile for nhc98. The recent patch changing its implementation was insufficiently portable. --- diff --git a/System/Directory.hs b/System/Directory.hs index fcdb937..1f624a1 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -76,6 +76,7 @@ import Control.Exception #ifdef __NHC__ import Directory +import System (system) #endif /* __NHC__ */ #ifdef __HUGS__ @@ -513,6 +514,12 @@ copied to /new/, if possible. -} copyFile :: FilePath -> FilePath -> IO () +#ifdef __NHC__ +copyFile fromFPath toFPath = + do readFile fromFPath >>= writeFile toFPath + try (copyPermissions fromFPath toFPath) + return () +#else copyFile fromFPath toFPath = copy `catch` (\e -> case e of IOException e -> @@ -534,6 +541,7 @@ copyFile fromFPath toFPath = when (count > 0) $ do hPutBuf hTo buffer count copyContents hFrom hTo buffer +#endif -- | Given path referring to a file or directory, returns a -- canonicalized path, with the intent that two paths referring