From c2ae7a8c71a61c53c27d065c71edca9ffb94da86 Mon Sep 17 00:00:00 2001 From: Don Stewart Date: Mon, 19 Nov 2007 01:15:28 +0000 Subject: [PATCH] only check xmonad.hs against the xmonad binary, not the .o file (meaning you can remove it if you like) --- XMonad/Core.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/XMonad/Core.hs b/XMonad/Core.hs index 90bfd9a..5ea2d03 100644 --- a/XMonad/Core.hs +++ b/XMonad/Core.hs @@ -297,16 +297,18 @@ restart mprog resume = do -- The -i flag is used to restrict recompilation to the xmonad.hs file. -- Raises an exception if GHC can't be found, or if anything else goes wrong. -- +-- The file is only recompiled if it is newer than its binary. +-- recompile :: IO () recompile = do - dir <- liftM (++ "/.xmonad") getHomeDirectory - let src = dir ++ "/" ++ "xmonad.hs" - obj = dir ++ "/" ++ "xmonad.o" - yes <- doesFileExist src + dir <- liftM (++ "/.xmonad") getHomeDirectory + let bin = dir ++ "/" ++ "xmonad" + src = bin ++ ".hs" + yes <- doesFileExist src when yes $ do srcT <- getModificationTime src - objT <- getModificationTime obj - when (srcT > objT) $ do + binT <- getModificationTime bin + when (srcT > binT) $ do waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i"] (Just dir) Nothing Nothing Nothing Nothing return ()