From: Ian Lynagh Date: Sun, 22 Jul 2007 10:34:05 +0000 (+0000) Subject: Fix whitespace X-Git-Tag: 2007-09-13~5 X-Git-Url: http://git.megacz.com/?p=haskell-directory.git;a=commitdiff_plain;h=08b1730186cae35448d2f8f0e1d3f67db5cac01b Fix whitespace --- diff --git a/System/Directory.hs b/System/Directory.hs index 3301ed3..e6b49c2 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -543,26 +543,27 @@ However, it certainly isn't always what you want. copyFile :: FilePath -> FilePath -> IO () copyFile fromFPath toFPath = #if (!(defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ > 600)) - do readFile fromFPath >>= writeFile toFPath - try (copyPermissions fromFPath toFPath) - return () + do readFile fromFPath >>= writeFile toFPath + try (copyPermissions fromFPath toFPath) + return () #else - (bracket (openBinaryFile fromFPath ReadMode) hClose $ \hFrom -> - bracket (openBinaryFile toFPath WriteMode) hClose $ \hTo -> - allocaBytes bufferSize $ \buffer -> do - copyContents hFrom hTo buffer - try (copyPermissions fromFPath toFPath) - return ()) `catch` (ioError . changeFunName) - where - bufferSize = 1024 - - changeFunName (IOError h iot fun str mb_fp) = IOError h iot "copyFile" str mb_fp - - copyContents hFrom hTo buffer = do - count <- hGetBuf hFrom buffer bufferSize - when (count > 0) $ do - hPutBuf hTo buffer count - copyContents hFrom hTo buffer + (bracket (openBinaryFile fromFPath ReadMode) hClose $ \hFrom -> + bracket (openBinaryFile toFPath WriteMode) hClose $ \hTo -> + allocaBytes bufferSize $ \buffer -> do + copyContents hFrom hTo buffer + try (copyPermissions fromFPath toFPath) + return ()) `catch` (ioError . changeFunName) + where + bufferSize = 1024 + + changeFunName (IOError h iot fun str mb_fp) + = IOError h iot "copyFile" str mb_fp + + copyContents hFrom hTo buffer = do + count <- hGetBuf hFrom buffer bufferSize + when (count > 0) $ do + hPutBuf hTo buffer count + copyContents hFrom hTo buffer #endif -- | Given path referring to a file or directory, returns a