From 63b06627f200f155f66ecdb6c5f41ab44808dd6b Mon Sep 17 00:00:00 2001 From: pacien Date: Fri, 27 Dec 2019 12:38:01 +0100 Subject: compiler: add compiler config keys --- compiler/src/Files.hs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'compiler/src/Files.hs') diff --git a/compiler/src/Files.hs b/compiler/src/Files.hs index 23daf3a..fb46c33 100644 --- a/compiler/src/Files.hs +++ b/compiler/src/Files.hs @@ -26,7 +26,7 @@ module Files , (), (), localPath, webPath , FSNode(..), AnchoredFSNode(..) , nodePath, nodeName, isHidden, flattenDir, filterDir, readDirectory - , ensureParentDir, remove + , ensureParentDir, remove, isOutdated ) where @@ -36,6 +36,8 @@ import Data.List (isPrefixOf, length, deleteBy) import Data.Function ((&)) import System.Directory ( doesDirectoryExist + , doesPathExist + , getModificationTime , listDirectory , createDirectoryIfMissing , removePathForcibly ) @@ -128,3 +130,16 @@ remove path = do putStrLn $ "Removing:\t" ++ path removePathForcibly path + +isOutdated :: FilePath -> FilePath -> IO Bool +isOutdated ref target = + do + refExists <- doesPathExist ref + targetExists <- doesPathExist target + if refExists && targetExists then + do + refTime <- getModificationTime ref + targetTime <- getModificationTime target + return (targetTime < refTime) + else + return True -- cgit v1.2.3