aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Processors.hs
diff options
context:
space:
mode:
authorpacien2019-12-27 12:38:01 +0100
committerpacien2019-12-27 12:38:01 +0100
commit63b06627f200f155f66ecdb6c5f41ab44808dd6b (patch)
tree64eee82c70b3a3b85f062a7ecb3508912840eb30 /compiler/src/Processors.hs
parentc3f1d45743e274f588e5a23ba25e1fc124728c11 (diff)
downloadldgallery-63b06627f200f155f66ecdb6c5f41ab44808dd6b.tar.gz
compiler: add compiler config keys
Diffstat (limited to 'compiler/src/Processors.hs')
-rw-r--r--compiler/src/Processors.hs12
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)
36import Data.Function ((&)) 36import Data.Function ((&))
37import Data.Ratio ((%)) 37import Data.Ratio ((%))
38 38
39import GHC.Generics (Generic)
40import Data.Aeson (FromJSON)
41
39import System.Directory hiding (copyFile) 42import System.Directory hiding (copyFile)
40import qualified System.Directory 43import qualified System.Directory
41import System.FilePath 44import System.FilePath
@@ -64,7 +67,7 @@ formatFromExt _ = Other
64 67
65data Resolution = Resolution 68data Resolution = Resolution
66 { width :: Int 69 { width :: Int
67 , height :: Int } deriving Show 70 , height :: Int } deriving (Show, Generic, FromJSON)
68 71
69type FileProcessor = 72type 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
155type DirFileProcessor = 151type DirFileProcessor =
156 FileName -- ^ Input base path 152 FileName -- ^ Input base path