Skip to content
Snippets Groups Projects
Commit bff3893a authored by sof's avatar sof
Browse files

[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.
parent 34cd3a8a
No related merge requests found
...@@ -49,6 +49,7 @@ import UniqSupply ...@@ -49,6 +49,7 @@ import UniqSupply
import Util import Util
import Outputable import Outputable
import DirUtils ( getDirectoryContents ) import DirUtils ( getDirectoryContents )
import IO ( hPutStrLn, stderr, isDoesNotExistError )
infixr 9 `thenRn`, `thenRn_` infixr 9 `thenRn`, `thenRn_`
\end{code} \end{code}
...@@ -354,10 +355,22 @@ mkModuleHiMap dirs = do ...@@ -354,10 +355,22 @@ mkModuleHiMap dirs = do
| otherwise = old_path -- don't warn about innocous shadowings. | otherwise = old_path -- don't warn about innocous shadowings.
getAllFilesMatching :: FilePath -> String -> IO [(String, FilePath)] getAllFilesMatching :: FilePath -> String -> IO [(String, FilePath)]
getAllFilesMatching dir_path suffix = do getAllFilesMatching dir_path suffix = (do
fpaths <- getDirectoryContents dir_path fpaths <- getDirectoryContents dir_path
-- fpaths entries do not have dir_path prepended -- fpaths entries do not have dir_path prepended
return (mapMaybe withSuffix fpaths) 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 where
xiffus = reverse dotted_suffix xiffus = reverse dotted_suffix
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment