-----------------------------------------------------------------------------
--- $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
--
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
)
-----------------------------------------------------------------------------
+-- 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
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)