need to stat symlink

This commit is contained in:
Joey Hess 2013-12-18 15:20:26 -04:00
parent d088b37d75
commit 6e3cc0a228

View file

@ -60,12 +60,18 @@ dirContentsRecursiveSkipping skipdir followsubdirsymlinks topdir = go [topdir]
collect files dirs' (entry:entries) collect files dirs' (entry:entries)
| dirCruft entry = collect files dirs' entries | dirCruft entry = collect files dirs' entries
| otherwise = do | otherwise = do
ms <- catchMaybeIO $ getFileStatus entry let skip = collect (entry:files) dirs' entries
let recurse = collect files (entry:dirs') entries
ms <- catchMaybeIO $ getSymbolicLinkStatus entry
case ms of case ms of
(Just s) | isDirectory s || (isSymbolicLink s && followsubdirsymlinks) -> (Just s)
collect files (entry:dirs') entries | isDirectory s -> recurse
_ -> | isSymbolicLink s && followsubdirsymlinks ->
collect (entry:files) dirs' entries ifM (doesDirectoryExist entry)
( recurse
, skip
)
_ -> skip
{- Moves one filename to another. {- Moves one filename to another.
- First tries a rename, but falls back to moving across devices if needed. -} - First tries a rename, but falls back to moving across devices if needed. -}