[commit: ghc] master: Delete hack when takeDirectory returns "" (2a743bb)

git at git.haskell.org git at git.haskell.org
Tue Sep 23 13:45:38 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2a743bbddd4de41a77af9b83ec4720cd013292cf/ghc

>---------------------------------------------------------------

commit 2a743bbddd4de41a77af9b83ec4720cd013292cf
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Tue Sep 23 08:44:02 2014 -0500

    Delete hack when takeDirectory returns ""
    
    Summary:
    Since commits 8fe1f8 and bb6731 in the filepath packages (ticket #2034, closed
    in 2010), takeDirectory "foo" returns ".", and not "", so this check is no
    longer needed.
    
    Other commits:
    * Remove trailing whitespace
    * Update comments for #2278
    
    Test Plan: harbormaster
    
    Reviewers: austin
    
    Reviewed By: austin
    
    Subscribers: simonmar, ezyang, carter
    
    Differential Revision: https://phabricator.haskell.org/D213
    
    GHC Trac Issues: #2034


>---------------------------------------------------------------

2a743bbddd4de41a77af9b83ec4720cd013292cf
 compiler/utils/Util.lhs | 4 +---
 ghc/Main.hs             | 6 +++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs
index 97bafe6..999eb90 100644
--- a/compiler/utils/Util.lhs
+++ b/compiler/utils/Util.lhs
@@ -950,9 +950,7 @@ maybeReadFuzzy str = case reads str of
 -- Verify that the 'dirname' portion of a FilePath exists.
 --
 doesDirNameExist :: FilePath -> IO Bool
-doesDirNameExist fpath = case takeDirectory fpath of
-                         "" -> return True -- XXX Hack
-                         _  -> doesDirectoryExist (takeDirectory fpath)
+doesDirNameExist fpath = doesDirectoryExist (takeDirectory fpath)
 
 -----------------------------------------------------------------------------
 -- Backwards compatibility definition of getModificationTime
diff --git a/ghc/Main.hs b/ghc/Main.hs
index e6ff043..c1ee247 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -345,16 +345,16 @@ checkOptions mode dflags srcs objs = do
 
 -- Compiler output options
 
--- called to verify that the output files & directories
--- point somewhere valid.
+-- Called to verify that the output files point somewhere valid.
 --
 -- The assumption is that the directory portion of these output
 -- options will have to exist by the time 'verifyOutputFiles'
 -- is invoked.
 --
+-- We create the directories for -odir, -hidir, -outputdir etc. ourselves if
+-- they don't exist, so don't check for those here (#2278).
 verifyOutputFiles :: DynFlags -> IO ()
 verifyOutputFiles dflags = do
-  -- not -odir: we create the directory for -odir if it doesn't exist (#2278).
   let ofile = outputFile dflags
   when (isJust ofile) $ do
      let fn = fromJust ofile



More information about the ghc-commits mailing list