summaryrefslogtreecommitdiff
path: root/Build/EvilSplicer.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Build/EvilSplicer.hs')
-rw-r--r--Build/EvilSplicer.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Build/EvilSplicer.hs b/Build/EvilSplicer.hs
index 3927fcc5a..2a1984ed6 100644
--- a/Build/EvilSplicer.hs
+++ b/Build/EvilSplicer.hs
@@ -35,6 +35,7 @@ import Data.Char
import System.Environment
import System.FilePath
import System.Directory
+import Control.Monad
import Utility.Monad
import Utility.Misc
@@ -179,7 +180,10 @@ applySplices destdir imports l@(first:_) = do
putStrLn $ "splicing " ++ f
lls <- map (++ "\n") . lines <$> readFileStrict f
createDirectoryIfMissing True (parentDir dest)
- writeFile dest $ concat $ addimports $ expand lls l
+ let newcontent = concat $ addimports $ expand lls l
+ oldcontent <- catchMaybeIO $ readFile dest
+ when (oldcontent /= Just newcontent) $
+ writeFile dest newcontent
where
expand lls [] = lls
expand lls (s:rest) = expand (expandSplice s lls) rest