diff options
Diffstat (limited to 'compiler/src')
-rw-r--r-- | compiler/src/Compiler.hs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/compiler/src/Compiler.hs b/compiler/src/Compiler.hs index d392f74..adc4a5f 100644 --- a/compiler/src/Compiler.hs +++ b/compiler/src/Compiler.hs | |||
@@ -70,10 +70,10 @@ writeJSON outputPath object = | |||
70 | ensureParentDir JSON.encodeFile outputPath object | 70 | ensureParentDir JSON.encodeFile outputPath object |
71 | 71 | ||
72 | 72 | ||
73 | galleryDirFilter :: CompilerConfig -> FilePath -> FSNode -> Bool | 73 | galleryDirFilter :: CompilerConfig -> [FilePath] -> FSNode -> Bool |
74 | galleryDirFilter config outputDir = | 74 | galleryDirFilter config excludedCanonicalDirs = |
75 | (not . isHidden) | 75 | (not . isHidden) |
76 | &&& (not . isOutputGallery) | 76 | &&& (not . isExcludedDir) |
77 | &&& (not . matchesFile (== galleryConf)) | 77 | &&& (not . matchesFile (== galleryConf)) |
78 | &&& ((matchesDir $ anyPattern $ includedDirectories config) ||| | 78 | &&& ((matchesDir $ anyPattern $ includedDirectories config) ||| |
79 | (matchesFile $ anyPattern $ includedFiles config)) | 79 | (matchesFile $ anyPattern $ includedFiles config)) |
@@ -95,20 +95,20 @@ galleryDirFilter config outputDir = | |||
95 | anyPattern :: [String] -> FileName -> Bool | 95 | anyPattern :: [String] -> FileName -> Bool |
96 | anyPattern patterns filename = any (flip Glob.match filename) (map Glob.compile patterns) | 96 | anyPattern patterns filename = any (flip Glob.match filename) (map Glob.compile patterns) |
97 | 97 | ||
98 | isOutputGallery :: FSNode -> Bool | 98 | isExcludedDir :: FSNode -> Bool |
99 | isOutputGallery Dir{canonicalPath} = canonicalPath == outputDir | 99 | isExcludedDir Dir{canonicalPath} = any (canonicalPath ==) excludedCanonicalDirs |
100 | isOutputGallery File{} = False | 100 | isExcludedDir File{} = False |
101 | 101 | ||
102 | 102 | ||
103 | compileGallery :: FilePath -> FilePath -> Bool -> Bool -> IO () | 103 | compileGallery :: FilePath -> FilePath -> [FilePath] -> Bool -> Bool -> IO () |
104 | compileGallery inputDirPath outputDirPath rebuildAll cleanOutput = | 104 | compileGallery inputDirPath outputDirPath excludedDirs rebuildAll cleanOutput = |
105 | do | 105 | do |
106 | fullConfig <- readConfig inputGalleryConf | 106 | fullConfig <- readConfig inputGalleryConf |
107 | let config = compiler fullConfig | 107 | let config = compiler fullConfig |
108 | 108 | ||
109 | inputDir <- readDirectory inputDirPath | 109 | inputDir <- readDirectory inputDirPath |
110 | canonicalOutPath <- canonicalizePath outputDirPath | 110 | excludedCanonicalDirs <- mapM canonicalizePath excludedDirs |
111 | let sourceFilter = galleryDirFilter config canonicalOutPath | 111 | let sourceFilter = galleryDirFilter config excludedCanonicalDirs |
112 | let sourceTree = filterDir sourceFilter inputDir | 112 | let sourceTree = filterDir sourceFilter inputDir |
113 | inputTree <- readInputTree sourceTree | 113 | inputTree <- readInputTree sourceTree |
114 | 114 | ||