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/Processors.hs | |
parent | c3f1d45743e274f588e5a23ba25e1fc124728c11 (diff) | |
download | ldgallery-63b06627f200f155f66ecdb6c5f41ab44808dd6b.tar.gz |
compiler: add compiler config keys
Diffstat (limited to 'compiler/src/Processors.hs')
-rw-r--r-- | compiler/src/Processors.hs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/compiler/src/Processors.hs b/compiler/src/Processors.hs index aaa178f..c097db7 100644 --- a/compiler/src/Processors.hs +++ b/compiler/src/Processors.hs | |||
@@ -36,6 +36,9 @@ import Control.Exception (throwIO) | |||
36 | import Data.Function ((&)) | 36 | import Data.Function ((&)) |
37 | import Data.Ratio ((%)) | 37 | import Data.Ratio ((%)) |
38 | 38 | ||
39 | import GHC.Generics (Generic) | ||
40 | import Data.Aeson (FromJSON) | ||
41 | |||
39 | import System.Directory hiding (copyFile) | 42 | import System.Directory hiding (copyFile) |
40 | import qualified System.Directory | 43 | import qualified System.Directory |
41 | import System.FilePath | 44 | import System.FilePath |
@@ -64,7 +67,7 @@ formatFromExt _ = Other | |||
64 | 67 | ||
65 | data Resolution = Resolution | 68 | data Resolution = Resolution |
66 | { width :: Int | 69 | { width :: Int |
67 | , height :: Int } deriving Show | 70 | , height :: Int } deriving (Show, Generic, FromJSON) |
68 | 71 | ||
69 | type FileProcessor = | 72 | type FileProcessor = |
70 | FileName -- ^ Input path | 73 | FileName -- ^ Input path |
@@ -144,13 +147,6 @@ withCached processor inputPath outputPath = | |||
144 | update = processor inputPath outputPath | 147 | update = processor inputPath outputPath |
145 | skip = putStrLn $ "Skipping:\t" ++ outputPath | 148 | skip = putStrLn $ "Skipping:\t" ++ outputPath |
146 | 149 | ||
147 | isOutdated :: FilePath -> FilePath -> IO Bool | ||
148 | isOutdated ref target = | ||
149 | do | ||
150 | refTime <- getModificationTime ref | ||
151 | targetTime <- getModificationTime target | ||
152 | return (targetTime < refTime) | ||
153 | |||
154 | 150 | ||
155 | type DirFileProcessor = | 151 | type DirFileProcessor = |
156 | FileName -- ^ Input base path | 152 | FileName -- ^ Input base path |