[project @ 1998-10-23 09:48:46 by sof]
authorsof <unknown>
Fri, 23 Oct 1998 09:48:46 +0000 (09:48 +0000)
committersof <unknown>
Fri, 23 Oct 1998 09:48:46 +0000 (09:48 +0000)
getAllFilesMatching: increase malleability factor by a notch;
just warn if an element along the import search path doesn't
exist, don't barf.

ghc/compiler/rename/RnMonad.lhs

index 574ce86..f1b037f 100644 (file)
@@ -49,6 +49,7 @@ import UniqSupply
 import Util
 import Outputable
 import DirUtils                ( getDirectoryContents )
 import Util
 import Outputable
 import DirUtils                ( getDirectoryContents )
+import IO              ( hPutStrLn, stderr, isDoesNotExistError )
 
 infixr 9 `thenRn`, `thenRn_`
 \end{code}
 
 infixr 9 `thenRn`, `thenRn_`
 \end{code}
@@ -354,10 +355,22 @@ mkModuleHiMap dirs = do
     | otherwise = old_path  -- don't warn about innocous shadowings.
 
 getAllFilesMatching :: FilePath -> String -> IO [(String, FilePath)]
     | otherwise = old_path  -- don't warn about innocous shadowings.
 
 getAllFilesMatching :: FilePath -> String -> IO [(String, FilePath)]
-getAllFilesMatching dir_path suffix = do
+getAllFilesMatching dir_path suffix = (do
   fpaths <- getDirectoryContents dir_path
   -- fpaths entries do not have dir_path prepended
   return (mapMaybe withSuffix fpaths)
   fpaths <- getDirectoryContents dir_path
   -- fpaths entries do not have dir_path prepended
   return (mapMaybe withSuffix fpaths)
+   )  -- soft failure
+      `catch` 
+        (\ err -> do
+             hPutStrLn stderr 
+                    ("Import path element `" ++ dir_path ++ 
+                     if (isDoesNotExistError err) then
+                        "' does not exist, ignoring."
+                     else
+                       "' couldn't read, ignoring.")
+              
+              return [] 
+           )
  where
    xiffus = reverse dotted_suffix 
   
  where
    xiffus = reverse dotted_suffix