aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Compiler.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/Compiler.hs')
-rw-r--r--compiler/src/Compiler.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/src/Compiler.hs b/compiler/src/Compiler.hs
index 2970102..51f5065 100644
--- a/compiler/src/Compiler.hs
+++ b/compiler/src/Compiler.hs
@@ -51,8 +51,8 @@ import Processors
51defaultGalleryConf :: String 51defaultGalleryConf :: String
52defaultGalleryConf = "gallery.yaml" 52defaultGalleryConf = "gallery.yaml"
53 53
54indexFile :: String 54defaultIndexFile :: String
55indexFile = "index.json" 55defaultIndexFile = "index.json"
56 56
57itemsDir :: String 57itemsDir :: String
58itemsDir = "items" 58itemsDir = "items"
@@ -103,8 +103,8 @@ galleryDirFilter config excludedCanonicalDirs =
103 isExcludedDir File{} = False 103 isExcludedDir File{} = False
104 104
105 105
106compileGallery :: FilePath -> FilePath -> FilePath -> [FilePath] -> Bool -> Bool -> IO () 106compileGallery :: FilePath -> FilePath -> FilePath -> FilePath -> [FilePath] -> Bool -> Bool -> IO ()
107compileGallery configPath inputDirPath outputDirPath excludedDirs rebuildAll cleanOutput = 107compileGallery configPath inputDirPath outputDirPath outputIndexPath excludedDirs rebuildAll cleanOutput =
108 do 108 do
109 config <- readConfig $ inputGalleryConf configPath 109 config <- readConfig $ inputGalleryConf configPath
110 110
@@ -121,13 +121,17 @@ compileGallery configPath inputDirPath outputDirPath excludedDirs rebuildAll cle
121 resources <- galleryBuilder inputTree 121 resources <- galleryBuilder inputTree
122 122
123 when cleanOutput $ galleryCleanupResourceDir resources outputDirPath 123 when cleanOutput $ galleryCleanupResourceDir resources outputDirPath
124 writeJSON (outputDirPath </> indexFile) $ GalleryIndex (viewerConfig config) resources 124 writeJSON (outputGalleryIndex outputIndexPath) $ GalleryIndex (viewerConfig config) resources
125 125
126 where 126 where
127 inputGalleryConf :: FilePath -> FilePath 127 inputGalleryConf :: FilePath -> FilePath
128 inputGalleryConf "" = inputDirPath </> defaultGalleryConf 128 inputGalleryConf "" = inputDirPath </> defaultGalleryConf
129 inputGalleryConf file = file 129 inputGalleryConf file = file
130 130
131 outputGalleryIndex :: FilePath -> FilePath
132 outputGalleryIndex "" = outputDirPath </> defaultIndexFile
133 outputGalleryIndex file = file
134
131 itemProcessor config cache = 135 itemProcessor config cache =
132 itemFileProcessor 136 itemFileProcessor
133 (pictureMaxResolution config) cache 137 (pictureMaxResolution config) cache