diff options
author | Joey Hess <joey@kitenet.net> | 2011-04-02 15:50:51 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-04-02 15:50:51 -0400 |
commit | f005a84e5675cb3e551b2922ad42642df28264d6 (patch) | |
tree | 676305c323a4eb61e01b2c4212b9e63b5fc9d8b0 /Utility.hs | |
parent | 00b9a9a25d6032a29c053f970e861a8ee5fd3bf8 (diff) |
add loggedKeys
Diffstat (limited to 'Utility.hs')
-rw-r--r-- | Utility.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Utility.hs b/Utility.hs index 8312335f8..72f5c5063 100644 --- a/Utility.hs +++ b/Utility.hs @@ -22,6 +22,7 @@ module Utility ( readMaybe, safeWriteFile, dirContains, + dirContents, prop_idempotent_shellEscape, prop_idempotent_shellEscape_multiword, @@ -235,3 +236,14 @@ safeWriteFile file content = do createDirectoryIfMissing True (parentDir file) writeFile tmpfile content renameFile tmpfile file + +{- Lists the contents of a directory. + - Unlike getDirectoryContents, paths are not relative to the directory. -} +dirContents :: FilePath -> IO [FilePath] +dirContents d = do + c <- getDirectoryContents d + return $ map (d </>) $ filter notcruft c + where + notcruft "." = False + notcruft ".." = False + notcruft _ = True |