summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Utility/Directory.hs11
-rw-r--r--Utility/Path.hs9
2 files changed, 11 insertions, 9 deletions
diff --git a/Utility/Directory.hs b/Utility/Directory.hs
index e7b7c442b..40e65d634 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 eb530442b..76fbc6c4a 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)