From: sof Date: Fri, 23 Oct 1998 09:48:46 +0000 (+0000) Subject: [project @ 1998-10-23 09:48:46 by sof] X-Git-Tag: Approx_2487_patches~225 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=bff3893a94f6ae180c5c9c039e9ce05e1ceaa531;p=ghc-hetmet.git [project @ 1998-10-23 09:48:46 by sof] getAllFilesMatching: increase malleability factor by a notch; just warn if an element along the import search path doesn't exist, don't barf. --- diff --git a/ghc/compiler/rename/RnMonad.lhs b/ghc/compiler/rename/RnMonad.lhs index 574ce86..f1b037f 100644 --- a/ghc/compiler/rename/RnMonad.lhs +++ b/ghc/compiler/rename/RnMonad.lhs @@ -49,6 +49,7 @@ import UniqSupply import Util import Outputable import DirUtils ( getDirectoryContents ) +import IO ( hPutStrLn, stderr, isDoesNotExistError ) 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)] -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) + ) -- 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