From 119d837edce4d4c109539b6722fab162ab29c0b0 Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 29 Dec 2019 09:54:55 +0100 Subject: compiler: allow fast recovery from partial gallery compilation --- compiler/src/Compiler.hs | 2 +- compiler/src/Files.hs | 6 +++--- compiler/src/Processors.hs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'compiler/src') 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 = let sourceTree = filterDir galleryDirFilter inputDir inputTree <- readInputTree sourceTree - invalidateCache <- isOutdated inputGalleryConf outputIndex + invalidateCache <- isOutdated False inputGalleryConf outputIndex let cache = if invalidateCache || rebuildAll then skipCached else withCached let itemProc = itemProcessor (pictureMaxResolution config) cache 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 = putStrLn $ "Removing:\t" ++ path removePathForcibly path -isOutdated :: FilePath -> FilePath -> IO Bool -isOutdated ref target = +isOutdated :: Bool -> FilePath -> FilePath -> IO Bool +isOutdated onMissingTarget ref target = do refExists <- doesPathExist ref targetExists <- doesPathExist target @@ -142,4 +142,4 @@ isOutdated ref target = targetTime <- getModificationTime target return (targetTime < refTime) else - return True + 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 = fileExists <- doesFileExist outputPath if fileExists then do - needUpdate <- isOutdated inputPath outputPath + needUpdate <- isOutdated True inputPath outputPath if needUpdate then update else skip else update -- cgit v1.2.3