diff options
Diffstat (limited to 'compiler/src/Compiler.hs')
-rw-r--r-- | compiler/src/Compiler.hs | 14 |
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 | |||
51 | defaultGalleryConf :: String | 51 | defaultGalleryConf :: String |
52 | defaultGalleryConf = "gallery.yaml" | 52 | defaultGalleryConf = "gallery.yaml" |
53 | 53 | ||
54 | indexFile :: String | 54 | defaultIndexFile :: String |
55 | indexFile = "index.json" | 55 | defaultIndexFile = "index.json" |
56 | 56 | ||
57 | itemsDir :: String | 57 | itemsDir :: String |
58 | itemsDir = "items" | 58 | itemsDir = "items" |
@@ -103,8 +103,8 @@ galleryDirFilter config excludedCanonicalDirs = | |||
103 | isExcludedDir File{} = False | 103 | isExcludedDir File{} = False |
104 | 104 | ||
105 | 105 | ||
106 | compileGallery :: FilePath -> FilePath -> FilePath -> [FilePath] -> Bool -> Bool -> IO () | 106 | compileGallery :: FilePath -> FilePath -> FilePath -> FilePath -> [FilePath] -> Bool -> Bool -> IO () |
107 | compileGallery configPath inputDirPath outputDirPath excludedDirs rebuildAll cleanOutput = | 107 | compileGallery 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 |