Permalink
Browse files

When importing a module, check to see if it's been changed since it w…

…as serialized; if it has, re-serialize it.
  • Loading branch information...
1 parent e39e83e commit ace9df0ac6b49c2e5ff8c554e2fc332d83984414 @bendmorris committed Jan 25, 2011
Showing with 7 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +6 −1 ReadFile.hs
View
@@ -3,6 +3,7 @@
*.txt
*.deb
*.sco
+*.osc
control
scotch
scotch.lib/parscotch/*
View
@@ -143,7 +143,12 @@ execute :: Bool -> String -> VarDict -> IO VarDict
execute verbose file bindings = do optimized <- doesFileExist (file ++ ".osc")
input <- Prelude.readFile (file ++ ".sco")
parsed <- case optimized of
- True -> do bytes <- Data.ByteString.Lazy.readFile (file ++ ".osc")
+ True -> do t1 <- getModificationTime (file ++ ".sco")
+ t2 <- getModificationTime (file ++ ".osc")
+ if t1 > t2 then do let exprs = (Parse.read (file ++ ".sco") input)
+ serialize (file ++ ".osc") exprs
+ else do return ()
+ bytes <- Data.ByteString.Lazy.readFile (file ++ ".osc")
return $ Parse.readBinary (bytes)
False -> do let exprs = (Parse.read (file ++ ".sco") input)
serialize (file ++ ".osc") exprs

0 comments on commit ace9df0

Please sign in to comment.