diff options
author | Takano Akio <aljee@hyper.cx> | 2012-02-22 10:18:29 +0800 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2012-02-27 14:35:08 +0000 |
commit | ffe282cef4213ab8de515a8574d366994d38d5dd (patch) | |
tree | 019b4599a285dd8d4d141c458f708cc1fb129b4c /compiler/utils/Util.lhs | |
parent | ebd0ac736a305a5cd573e60f177b2995b37d964b (diff) | |
download | haskell-ffe282cef4213ab8de515a8574d366994d38d5dd.tar.gz |
Replace createDirectoryHierarchy with createDirectoryIfMissing True
createDirectoryHierarchy consisted of an existence test followed by
createDirectory, which failed if that directory was creted just after
the test. createDirectoryifMissing does not have this problem.
Diffstat (limited to 'compiler/utils/Util.lhs')
-rw-r--r-- | compiler/utils/Util.lhs | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index d09a1ad345..12249d3a2b 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -74,7 +74,6 @@ module Util ( maybeRead, maybeReadFuzzy, -- * IO-ish utilities - createDirectoryHierarchy, doesDirNameExist, getModificationUTCTime, modificationTimeIfExists, @@ -109,10 +108,9 @@ import Data.List hiding (group) import FastTypes #endif -import Control.Monad ( unless, liftM ) +import Control.Monad ( liftM ) import System.IO.Error as IO ( isDoesNotExistError ) -import System.Directory ( doesDirectoryExist, createDirectory, - getModificationTime ) +import System.Directory ( doesDirectoryExist, getModificationTime ) import System.FilePath import Data.Char ( isUpper, isAlphaNum, isSpace, chr, ord, isDigit ) @@ -1018,16 +1016,6 @@ maybeReadFuzzy str = case reads str of Nothing ----------------------------------------------------------------------------- --- Create a hierarchy of directories - -createDirectoryHierarchy :: FilePath -> IO () -createDirectoryHierarchy dir | isDrive dir = return () -- XXX Hack -createDirectoryHierarchy dir = do - b <- doesDirectoryExist dir - unless b $ do createDirectoryHierarchy (takeDirectory dir) - createDirectory dir - ------------------------------------------------------------------------------ -- Verify that the 'dirname' portion of a FilePath exists. -- doesDirNameExist :: FilePath -> IO Bool |