diff --git a/ghc/compiler/rename/RnMonad.lhs b/ghc/compiler/rename/RnMonad.lhs index 574ce864cfa81f2134c7dc6af87b37b24ef694d8..f1b037fa8ea450691ce05fd1e620f797e7966687 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