Fix compilation of Setup.hs with GHC 6.9 6_10_branch_has_been_forked
authorIan Lynagh <igloo@earth.li>
Tue, 16 Sep 2008 22:01:52 +0000 (22:01 +0000)
committerIan Lynagh <igloo@earth.li>
Tue, 16 Sep 2008 22:01:52 +0000 (22:01 +0000)
Setup.hs

index ebd4ce7..5e736ab 100644 (file)
--- a/Setup.hs
+++ b/Setup.hs
@@ -16,7 +16,6 @@ import System.Cmd
 import System.FilePath
 import System.Exit
 import System.Directory
-import Control.Exception (try)
 
 main :: IO ()
 main = do let hooks = simpleUserHooks {
@@ -85,5 +84,7 @@ maybeUpdateFile source target = do
   r <- rawSystem "cmp" ["-s" {-quiet-}, source, target]
   case r of
     ExitSuccess   -> removeFile source
-    ExitFailure _ -> do try (removeFile target); renameFile source target
+    ExitFailure _ -> do exists <- doesFileExist target
+                        when exists $ removeFile target
+                        renameFile source target