Skip to content

Commit 66f0a5b

Browse files
committed
Include only existent files (no dirs)
1 parent b2f3604 commit 66f0a5b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Hie/Implicit/Cradle.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,12 @@ findFileUpwards p dir = do
174174
-- | Sees if any file in the directory matches the predicate
175175
findFile :: (FilePath -> Bool) -> FilePath -> IO [FilePath]
176176
findFile p dir = do
177-
b <- doesDirectoryExist dir
177+
b <- doesDirectoryExist dir
178178
if b then getFiles else pure []
179179
where
180-
getFiles = filter p <$> getDirectoryContents dir
180+
getFiles = do
181+
files <- filter p <$> getDirectoryContents dir
182+
filterM doesPredFileExist files
181183
doesPredFileExist file = doesFileExist $ dir </> file
182184

183185
biosWorkDir :: FilePath -> MaybeT IO FilePath

0 commit comments

Comments
 (0)