From bff3893a94f6ae180c5c9c039e9ce05e1ceaa531 Mon Sep 17 00:00:00 2001 From: sof <unknown> Date: Fri, 23 Oct 1998 09:48:46 +0000 Subject: [PATCH] [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. --- ghc/compiler/rename/RnMonad.lhs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ghc/compiler/rename/RnMonad.lhs b/ghc/compiler/rename/RnMonad.lhs index 574ce864cfa8..f1b037fa8ea4 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 -- GitLab