Don't be so promiscuous about hoovering up any and all files into the
home/package directory caches.
home_imports <- readIORef v_Import_paths
let extendFM fm path = do
contents <- getDirectoryContents' path
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
home_map <- foldM extendFM emptyFM home_imports
writeIORef v_HomeDirCache (Just home_map)
return home_map
pkg_name = _PK_ (name pkg)
let addDir fm dir = do
contents <- getDirectoryContents' dir
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
(repeat (pkg_name,dir))))
foldM addDir fm dirs
+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
getDirectoryContents' d
= IO.catch (getDirectoryContents d)
(\_ -> do hPutStr stderr