diff options
author | Joey Hess <joey@kitenet.net> | 2013-10-07 13:03:05 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-10-07 13:03:05 -0400 |
commit | 894422e4234a463d34faf168b7b7cae68972a350 (patch) | |
tree | 08a2987bfb1a3522182b44ee814670407b095c61 /Utility | |
parent | 2c056703aad7cce36e8bc9213b3f922c5823c901 (diff) |
import: Skip .git directories.
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/Directory.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Utility/Directory.hs b/Utility/Directory.hs index 42de1e8dd..4918d20be 100644 --- a/Utility/Directory.hs +++ b/Utility/Directory.hs @@ -40,12 +40,13 @@ dirContents d = map (d </>) . filter (not . dirCruft) <$> getDirectoryContents d dirContentsRecursive :: FilePath -> IO [FilePath] dirContentsRecursive topdir = dirContentsRecursiveSkipping (const False) topdir +{- Skips directories whose basenames match the skipdir. -} dirContentsRecursiveSkipping :: (FilePath -> Bool) -> FilePath -> IO [FilePath] dirContentsRecursiveSkipping skipdir topdir = go [topdir] where go [] = return [] go (dir:dirs) - | skipdir dir = go dirs + | skipdir (takeFileName dir) = go dirs | otherwise = unsafeInterleaveIO $ do (files, dirs') <- collect [] [] =<< catchDefaultIO [] (dirContents dir) |