diff options
author | pacien | 2019-12-29 09:54:55 +0100 |
---|---|---|
committer | pacien | 2019-12-29 09:54:55 +0100 |
commit | 119d837edce4d4c109539b6722fab162ab29c0b0 (patch) | |
tree | 6fb2c1e188d839c87ee9db90fe0b0a1ae6a29059 /compiler/src | |
parent | 1872dbe68d4a68f43990f8a93e3ff4716eecf525 (diff) | |
download | ldgallery-119d837edce4d4c109539b6722fab162ab29c0b0.tar.gz |
compiler: allow fast recovery from partial gallery compilation
Diffstat (limited to 'compiler/src')
-rw-r--r-- | compiler/src/Compiler.hs | 2 | ||||
-rw-r--r-- | compiler/src/Files.hs | 6 | ||||
-rw-r--r-- | compiler/src/Processors.hs | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/compiler/src/Compiler.hs b/compiler/src/Compiler.hs index dbe6cae..0a3e540 100644 --- a/compiler/src/Compiler.hs +++ b/compiler/src/Compiler.hs | |||
@@ -73,7 +73,7 @@ compileGallery inputDirPath outputDirPath rebuildAll = | |||
73 | let sourceTree = filterDir galleryDirFilter inputDir | 73 | let sourceTree = filterDir galleryDirFilter inputDir |
74 | inputTree <- readInputTree sourceTree | 74 | inputTree <- readInputTree sourceTree |
75 | 75 | ||
76 | invalidateCache <- isOutdated inputGalleryConf outputIndex | 76 | invalidateCache <- isOutdated False inputGalleryConf outputIndex |
77 | let cache = if invalidateCache || rebuildAll then skipCached else withCached | 77 | let cache = if invalidateCache || rebuildAll then skipCached else withCached |
78 | let itemProc = itemProcessor (pictureMaxResolution config) cache | 78 | let itemProc = itemProcessor (pictureMaxResolution config) cache |
79 | let thumbnailProc = thumbnailProcessor (thumbnailResolution config) cache | 79 | let thumbnailProc = thumbnailProcessor (thumbnailResolution config) cache |
diff --git a/compiler/src/Files.hs b/compiler/src/Files.hs index fb46c33..079da61 100644 --- a/compiler/src/Files.hs +++ b/compiler/src/Files.hs | |||
@@ -131,8 +131,8 @@ remove path = | |||
131 | putStrLn $ "Removing:\t" ++ path | 131 | putStrLn $ "Removing:\t" ++ path |
132 | removePathForcibly path | 132 | removePathForcibly path |
133 | 133 | ||
134 | isOutdated :: FilePath -> FilePath -> IO Bool | 134 | isOutdated :: Bool -> FilePath -> FilePath -> IO Bool |
135 | isOutdated ref target = | 135 | isOutdated onMissingTarget ref target = |
136 | do | 136 | do |
137 | refExists <- doesPathExist ref | 137 | refExists <- doesPathExist ref |
138 | targetExists <- doesPathExist target | 138 | targetExists <- doesPathExist target |
@@ -142,4 +142,4 @@ isOutdated ref target = | |||
142 | targetTime <- getModificationTime target | 142 | targetTime <- getModificationTime target |
143 | return (targetTime < refTime) | 143 | return (targetTime < refTime) |
144 | else | 144 | else |
145 | return True | 145 | return onMissingTarget |
diff --git a/compiler/src/Processors.hs b/compiler/src/Processors.hs index 67f8619..7362822 100644 --- a/compiler/src/Processors.hs +++ b/compiler/src/Processors.hs | |||
@@ -140,7 +140,7 @@ withCached processor inputPath outputPath = | |||
140 | fileExists <- doesFileExist outputPath | 140 | fileExists <- doesFileExist outputPath |
141 | if fileExists then | 141 | if fileExists then |
142 | do | 142 | do |
143 | needUpdate <- isOutdated inputPath outputPath | 143 | needUpdate <- isOutdated True inputPath outputPath |
144 | if needUpdate then update else skip | 144 | if needUpdate then update else skip |
145 | else | 145 | else |
146 | update | 146 | update |