From 15c806adec22239096a910b92b49fcfb964815bd Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 30 Jan 2020 17:01:15 +0100 Subject: compiler: add flag for output dir cleanup Making it explicit. GitHub: closes #62 --- compiler/src/Compiler.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'compiler/src') diff --git a/compiler/src/Compiler.hs b/compiler/src/Compiler.hs index 27598b7..fc40a76 100644 --- a/compiler/src/Compiler.hs +++ b/compiler/src/Compiler.hs @@ -102,8 +102,8 @@ galleryDirFilter config = any (matchesFile (== indexFile) ||| matchesFile (== viewerMainFile)) items -compileGallery :: FilePath -> FilePath -> Bool -> IO () -compileGallery inputDirPath outputDirPath rebuildAll = +compileGallery :: FilePath -> FilePath -> Bool -> Bool -> IO () +compileGallery inputDirPath outputDirPath rebuildAll cleanOutput = do fullConfig <- readConfig inputGalleryConf let config = compiler fullConfig @@ -119,7 +119,11 @@ compileGallery inputDirPath outputDirPath rebuildAll = let galleryBuilder = buildGalleryTree itemProc thumbnailProc (tagsFromDirectories config) resources <- galleryBuilder (galleryName config) inputTree - galleryCleanupResourceDir resources outputDirPath + if cleanOutput then + galleryCleanupResourceDir resources outputDirPath + else + return () + writeJSON outputIndex resources writeJSON outputViewerConf $ viewer fullConfig -- cgit v1.2.3