diff options
author | Joey Hess <joey@kitenet.net> | 2013-12-18 15:20:26 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-12-18 15:20:26 -0400 |
commit | b8abb71955a96877f8b8befeb9892f9519a4fd82 (patch) | |
tree | 13ed94781ca1a73549b4bb1ddb000cf4b5591990 /Utility/Directory.hs | |
parent | bdfb25c5e76698f0aebe92f7e49028b0a0644fe5 (diff) |
need to stat symlink
Diffstat (limited to 'Utility/Directory.hs')
-rw-r--r-- | Utility/Directory.hs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Utility/Directory.hs b/Utility/Directory.hs index 27fbb22c6..2e3508e8d 100644 --- a/Utility/Directory.hs +++ b/Utility/Directory.hs @@ -60,12 +60,18 @@ dirContentsRecursiveSkipping skipdir followsubdirsymlinks topdir = go [topdir] collect files dirs' (entry:entries) | dirCruft entry = collect files dirs' entries | 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 - (Just s) | isDirectory s || (isSymbolicLink s && followsubdirsymlinks) -> - collect files (entry:dirs') entries - _ -> - collect (entry:files) dirs' entries + (Just s) + | isDirectory s -> recurse + | isSymbolicLink s && followsubdirsymlinks -> + ifM (doesDirectoryExist entry) + ( recurse + , skip + ) + _ -> skip {- Moves one filename to another. - First tries a rename, but falls back to moving across devices if needed. -} |