diff options
| author | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-02-06 22:40:18 +0100 |
|---|---|---|
| committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-02-06 22:40:18 +0100 |
| commit | ea953d3415232ba53aadc061e9005dbe74e3b012 (patch) | |
| tree | 10ea81bb0ddefd356d3ff84b25a5d49c8bcc5bd0 /src/Hakyll/Core/Util | |
| parent | d34d56b10e14e41ad303e6c5d3daef6970af65c2 (diff) | |
| download | hakyll-ea953d3415232ba53aadc061e9005dbe74e3b012.tar.gz | |
Ignore files sooner, small speedup
Diffstat (limited to 'src/Hakyll/Core/Util')
| -rw-r--r-- | src/Hakyll/Core/Util/File.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Hakyll/Core/Util/File.hs b/src/Hakyll/Core/Util/File.hs index 0e34d7c..20cfbbc 100644 --- a/src/Hakyll/Core/Util/File.hs +++ b/src/Hakyll/Core/Util/File.hs @@ -25,12 +25,13 @@ makeDirectories = createDirectoryIfMissing True . takeDirectory -------------------------------------------------------------------------------- -- | Get all contents of a directory. -getRecursiveContents :: FilePath -- ^ Directory to search - -> IO [FilePath] -- ^ List of files found -getRecursiveContents top = go "" +getRecursiveContents :: (FilePath -> Bool) -- ^ Ignore this file/directory + -> FilePath -- ^ Directory to search + -> IO [FilePath] -- ^ List of files found +getRecursiveContents ignore top = go "" where - isProper = (`notElem` [".", ".."]) - go dir = do + isProper x = notElem x [".", ".."] && not (ignore x) + go dir = do dirExists <- doesDirectoryExist (top </> dir) if not dirExists then return [] |
