[project @ 2002-09-25 11:55:07 by simonpj]
[ghc-hetmet.git] / ghc / compiler / main / DriverUtil.hs
index d788dd8..919fc3b 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverUtil.hs,v 1.31 2002/02/27 16:24:00 simonmar Exp $
+-- $Id: DriverUtil.hs,v 1.34 2002/09/13 15:02:34 simonpj Exp $
 --
 -- Utils for the driver
 --
@@ -16,11 +16,11 @@ import Util
 import Panic
 import Config          ( cLeadingUnderscore )
 
-import IOExts
-import Exception
-import Dynamic
+import EXCEPTION as Exception
+import DYNAMIC
+import DATA_IOREF      ( IORef, readIORef, writeIORef )
 
-import Directory       ( getDirectoryContents )
+import Directory       ( getDirectoryContents, doesDirectoryExist )
 import IO
 import List
 import Char
@@ -69,6 +69,13 @@ softGetDirectoryContents d
          )
 
 -----------------------------------------------------------------------------
+-- Verify that the 'dirname' portion of a FilePath exists.
+-- 
+doesDirNameExist :: FilePath -> IO Bool
+doesDirNameExist fpath = doesDirectoryExist (getdir fpath)
+
+
+-----------------------------------------------------------------------------
 -- Prefixing underscore to linker-level names
 prefixUnderscore :: String -> String
 prefixUnderscore
@@ -81,6 +88,9 @@ prefixUnderscore
 unknownFlagErr :: String -> a
 unknownFlagErr f = throwDyn (UsageError ("unrecognised flag: " ++ f))
 
+unknownFlagsErr :: [String] -> a
+unknownFlagsErr fs = throwDyn (UsageError ("unrecognised flags: " ++ unwords fs))
+
 my_partition :: (a -> Maybe b) -> [a] -> ([(a,b)],[a])
 my_partition _ [] = ([],[])
 my_partition p (a:as)