aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Compiler.hs
diff options
context:
space:
mode:
authorpacien2020-01-30 17:01:15 +0100
committerNotkea2020-01-30 17:17:59 +0100
commit15c806adec22239096a910b92b49fcfb964815bd (patch)
treead7123408a03bf40c40ebc2f5dc4e2382814ba08 /compiler/src/Compiler.hs
parent3ef8c5a3e92dab3178d7892606149fedfaadc31f (diff)
downloadldgallery-15c806adec22239096a910b92b49fcfb964815bd.tar.gz
compiler: add flag for output dir cleanup
Making it explicit. GitHub: closes #62
Diffstat (limited to 'compiler/src/Compiler.hs')
-rw-r--r--compiler/src/Compiler.hs10
1 files changed, 7 insertions, 3 deletions
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 =
102 any (matchesFile (== indexFile) ||| matchesFile (== viewerMainFile)) items 102 any (matchesFile (== indexFile) ||| matchesFile (== viewerMainFile)) items
103 103
104 104
105compileGallery :: FilePath -> FilePath -> Bool -> IO () 105compileGallery :: FilePath -> FilePath -> Bool -> Bool -> IO ()
106compileGallery inputDirPath outputDirPath rebuildAll = 106compileGallery inputDirPath outputDirPath rebuildAll cleanOutput =
107 do 107 do
108 fullConfig <- readConfig inputGalleryConf 108 fullConfig <- readConfig inputGalleryConf
109 let config = compiler fullConfig 109 let config = compiler fullConfig
@@ -119,7 +119,11 @@ compileGallery inputDirPath outputDirPath rebuildAll =
119 let galleryBuilder = buildGalleryTree itemProc thumbnailProc (tagsFromDirectories config) 119 let galleryBuilder = buildGalleryTree itemProc thumbnailProc (tagsFromDirectories config)
120 resources <- galleryBuilder (galleryName config) inputTree 120 resources <- galleryBuilder (galleryName config) inputTree
121 121
122 galleryCleanupResourceDir resources outputDirPath 122 if cleanOutput then
123 galleryCleanupResourceDir resources outputDirPath
124 else
125 return ()
126
123 writeJSON outputIndex resources 127 writeJSON outputIndex resources
124 writeJSON outputViewerConf $ viewer fullConfig 128 writeJSON outputViewerConf $ viewer fullConfig
125 129