@@ -44,7 +44,7 @@ ibcPath ibcsd use_ibcsd fp = let (d_fp, n_fp) = splitFileName fp
4444
4545ibcPathWithFallback :: FilePath -> FilePath -> IO FilePath
4646ibcPathWithFallback ibcsd fp = do let ibcp = ibcPath ibcsd True fp
47− ibc <- doesFileExist ibcp
47+ ibc <- doesFileExist' ibcp
4848 return (if ibc
4949 then ibcp
5050 else ibcPath ibcsd False fp)
@@ -58,9 +58,9 @@ findImport (d:ds) ibcsd fp = do let fp_full = d </> fp
5858 ibcp <- runIO $ ibcPathWithFallback ibcsd fp_full
5959 let idrp = srcPath fp_full
6060 let lidrp = lsrcPath fp_full
61− ibc <- runIO $ doesFileExist ibcp
62− idr <- runIO $ doesFileExist idrp
63− lidr <- runIO $ doesFileExist lidrp
61+ ibc <- runIO $ doesFileExist' ibcp
62+ idr <- runIO $ doesFileExist' idrp
63+ lidr <- runIO $ doesFileExist' lidrp
6464-- when idr $ putStrLn $ idrp ++ " ok"
6565-- when lidr $ putStrLn $ lidrp ++ " ok"
6666-- when ibc $ putStrLn $ ibcp ++ " ok"
@@ -78,7 +78,7 @@ findImport (d:ds) ibcsd fp = do let fp_full = d </> fp
7878findInPath :: [FilePath] -> FilePath -> IO FilePath
7979findInPath [] fp = fail $ "Can't find file " ++ fp
8080findInPath (d:ds) fp = do let p = d </> fp
81− e <- doesFileExist p
81+ e <- doesFileExist' p
8282 if e then return p else findInPath ds fp
8383
8484findPkgIndex :: String -> Idris FilePath
@@ -94,10 +94,26 @@ installedPackages = do
9494 where
9595 allFilesInDir base fp = do
9696 let fullpath = base </> fp
97− isDir <- doesDirectoryExist fullpath
97+ isDir <- doesDirectoryExist' fullpath
9898 if isDir
9999 then fmap concat (mapM (allFilesInDir fullpath) =<< dirContents fullpath)
100100 else return [fp]
101101 dirContents = fmap (filter (not . (`elem` [".", ".."]))) . getDirectoryContents
102102 goodDir idir d = any (".ibc" `isSuffixOf`) <$> allFilesInDir idir d
103103
104+
105+-- Case sensitive file existence check for Mac OS X.
106+doesFileExist' :: FilePath -> IO Bool
107+doesFileExist' = caseSensitive doesFileExist
108+
109+-- Case sensitive directory existence check for Mac OS X.
110+doesDirectoryExist' :: FilePath -> IO Bool
111+doesDirectoryExist' = caseSensitive doesDirectoryExist
112+
113+caseSensitive :: (FilePath -> IO Bool) -> FilePath -> IO Bool
114+caseSensitive existsCheck name =
115+ do exists <- existsCheck name
116+ if exists
117+ then do contents <- getDirectoryContents (takeDirectory name)
118+ return $ (takeFileName name) `elem` contents
119+ else return False