Commit 6eaf5c6c authored by sewardj's avatar sewardj
Browse files

[project @ 2000-10-30 11:36:09 by sewardj]

Don't be so promiscuous about hoovering up any and all files into the
home/package directory caches.
parent ed878dd2
......@@ -85,7 +85,8 @@ maybeHomeModule mod_name = do
home_imports <- readIORef v_Import_paths
let extendFM fm path = do
contents <- getDirectoryContents' path
return (addListToFM fm (zip contents (repeat path)))
let clean_contents = filter isUsefulFile contents
return (addListToFM fm (zip clean_contents (repeat path)))
home_map <- foldM extendFM emptyFM home_imports
writeIORef v_HomeDirCache (Just home_map)
return home_map
......@@ -136,7 +137,8 @@ newPkgCache pkgs = do
pkg_name = _PK_ (name pkg)
let addDir fm dir = do
contents <- getDirectoryContents' dir
return (addListToFM fm (zip contents
let clean_contents = filter isUsefulFile contents
return (addListToFM fm (zip clean_contents
(repeat (pkg_name,dir))))
foldM addDir fm dirs
......@@ -169,6 +171,10 @@ maybePackageModule mod_name = do
}
))
isUsefulFile fn
= let suffix = (reverse . takeWhile (/= '.') . reverse) fn
in suffix `elem` ["hi", "hs", "lhs", "hi-boot", "hi-boot-5"]
getDirectoryContents' d
= IO.catch (getDirectoryContents d)
(\_ -> do hPutStr stderr
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment