From 6fd0c0bfecb8e3585aecfa946515d89c8d443441 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 11 Mar 2012 18:12:36 -0400 Subject: [PATCH] move --- Utility/Directory.hs | 11 +++++++++++ Utility/Path.hs | 9 --------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Utility/Directory.hs b/Utility/Directory.hs index e7b7c442b2..40e65d6349 100644 --- a/Utility/Directory.hs +++ b/Utility/Directory.hs @@ -13,11 +13,22 @@ import System.Directory import Control.Exception (throw) import Control.Monad import Control.Monad.IfElse +import System.FilePath +import Control.Applicative import Utility.SafeCommand import Utility.TempFile import Utility.Exception +{- Lists the contents of a directory. + - Unlike getDirectoryContents, paths are not relative to the directory. -} +dirContents :: FilePath -> IO [FilePath] +dirContents d = map (d ) . filter notcruft <$> getDirectoryContents d + where + notcruft "." = False + notcruft ".." = False + notcruft _ = True + {- Moves one filename to another. - First tries a rename, but falls back to moving across devices if needed. -} moveFile :: FilePath -> FilePath -> IO () diff --git a/Utility/Path.hs b/Utility/Path.hs index eb530442b1..76fbc6c4a4 100644 --- a/Utility/Path.hs +++ b/Utility/Path.hs @@ -128,15 +128,6 @@ preserveOrder (l:ls) new = found ++ preserveOrder ls rest runPreserveOrder :: ([FilePath] -> IO [FilePath]) -> [FilePath] -> IO [FilePath] runPreserveOrder a files = preserveOrder files <$> a files -{- Lists the contents of a directory. - - Unlike getDirectoryContents, paths are not relative to the directory. -} -dirContents :: FilePath -> IO [FilePath] -dirContents d = map (d ) . filter notcruft <$> getDirectoryContents d - where - notcruft "." = False - notcruft ".." = False - notcruft _ = True - {- Current user's home directory. -} myHomeDir :: IO FilePath myHomeDir = homeDirectory <$> (getUserEntryForID =<< getEffectiveUserID)