diff options
author | pacien | 2019-12-27 12:38:01 +0100 |
---|---|---|
committer | pacien | 2019-12-27 12:38:01 +0100 |
commit | 63b06627f200f155f66ecdb6c5f41ab44808dd6b (patch) | |
tree | 64eee82c70b3a3b85f062a7ecb3508912840eb30 /compiler/src/Files.hs | |
parent | c3f1d45743e274f588e5a23ba25e1fc124728c11 (diff) | |
download | ldgallery-63b06627f200f155f66ecdb6c5f41ab44808dd6b.tar.gz |
compiler: add compiler config keys
Diffstat (limited to 'compiler/src/Files.hs')
-rw-r--r-- | compiler/src/Files.hs | 17 |
1 files changed, 16 insertions, 1 deletions
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 | |||
26 | , (</>), (</), (/>), localPath, webPath | 26 | , (</>), (</), (/>), localPath, webPath |
27 | , FSNode(..), AnchoredFSNode(..) | 27 | , FSNode(..), AnchoredFSNode(..) |
28 | , nodePath, nodeName, isHidden, flattenDir, filterDir, readDirectory | 28 | , nodePath, nodeName, isHidden, flattenDir, filterDir, readDirectory |
29 | , ensureParentDir, remove | 29 | , ensureParentDir, remove, isOutdated |
30 | ) where | 30 | ) where |
31 | 31 | ||
32 | 32 | ||
@@ -36,6 +36,8 @@ import Data.List (isPrefixOf, length, deleteBy) | |||
36 | import Data.Function ((&)) | 36 | import Data.Function ((&)) |
37 | import System.Directory | 37 | import System.Directory |
38 | ( doesDirectoryExist | 38 | ( doesDirectoryExist |
39 | , doesPathExist | ||
40 | , getModificationTime | ||
39 | , listDirectory | 41 | , listDirectory |
40 | , createDirectoryIfMissing | 42 | , createDirectoryIfMissing |
41 | , removePathForcibly ) | 43 | , removePathForcibly ) |
@@ -128,3 +130,16 @@ remove path = | |||
128 | do | 130 | do |
129 | putStrLn $ "Removing:\t" ++ path | 131 | putStrLn $ "Removing:\t" ++ path |
130 | removePathForcibly path | 132 | removePathForcibly path |
133 | |||
134 | isOutdated :: FilePath -> FilePath -> IO Bool | ||
135 | isOutdated ref target = | ||
136 | do | ||
137 | refExists <- doesPathExist ref | ||
138 | targetExists <- doesPathExist target | ||
139 | if refExists && targetExists then | ||
140 | do | ||
141 | refTime <- getModificationTime ref | ||
142 | targetTime <- getModificationTime target | ||
143 | return (targetTime < refTime) | ||
144 | else | ||
145 | return True | ||