[project @ 2001-05-03 12:33:50 by simonpj]
[ghc-hetmet.git] / ghc / compiler / main / DriverMkDepend.hs
index e22a1da..544296b 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverMkDepend.hs,v 1.7 2000/12/12 14:35:08 simonmar Exp $
+-- $Id: DriverMkDepend.hs,v 1.10 2001/04/26 14:33:44 simonmar Exp $
 --
 -- GHC Driver
 --
@@ -113,8 +113,8 @@ beginMkDependHS = do
        -- reference.
   import_dirs <- readIORef v_Import_paths
   pkg_import_dirs <- getPackageImportPath
-  import_dir_contents <- mapM getDirectoryContents import_dirs
-  pkg_import_dir_contents <- mapM getDirectoryContents pkg_import_dirs
+  import_dir_contents <- mapM softGetDirectoryContents import_dirs
+  pkg_import_dir_contents <- mapM softGetDirectoryContents pkg_import_dirs
   writeIORef v_Dep_dir_contents 
        (zip import_dirs import_dir_contents ++
         zip pkg_import_dirs pkg_import_dir_contents)
@@ -164,8 +164,8 @@ endMkDependHS = do
        (unwords [ "cp", tmp_file, makefile ])
 
 
-findDependency :: Bool -> String -> ModuleName -> IO (Maybe (String, Bool))
-findDependency is_source mod imp = do
+findDependency :: Bool -> FilePath -> ModuleName -> IO (Maybe (String, Bool))
+findDependency is_source src imp = do
    dir_contents <- readIORef v_Dep_dir_contents
    ignore_dirs  <- readIORef v_Dep_ignore_dirs
    hisuf <- readIORef v_Hi_suf
@@ -181,9 +181,8 @@ findDependency is_source mod imp = do
      deps | is_source = [ imp_hiboot_v, imp_hiboot, imp_hs, imp_lhs ]
          | otherwise = [ imp_hi, imp_hs, imp_lhs ]
 
-     search [] = throwDyn (OtherError ("can't find one of the following: " ++
-                                     unwords (map (\d -> '`': d ++ "'") deps) ++
-                                     " (imported from `" ++ mod ++ "')"))
+     search [] = throwDyn (ProgramError (src ++ ": " ++ "can't find one of the following: " ++
+                                     unwords (map (\d -> '`': d ++ "'") deps)))
      search ((dir, contents) : dirs)
           | null present = search dirs
           | otherwise = 
@@ -200,4 +199,3 @@ findDependency is_source mod imp = do
  
    -- in
    search dir_contents
-