eflint-3.0.0.1: src/Language/EFLINT/Util.hs
{-# LANGUAGE LambdaCase #-}
module Language.EFLINT.Util where
import Control.Monad (forM)
import System.FilePath
import System.Directory
find_included_file :: [FilePath] -> FilePath -> IO [FilePath]
find_included_file dirs path = do
concat <$> forM dirs (\dir -> do
let file = dir </> path
doesFileExist file >>= \case True -> return [file]
False -> (doesFileExist (file ++ ".eflint") >>= \case True -> return [file ++ ".eflint"]
False -> return []))