Added a message so that when we fail to find a file, we say exactly where we looked
This commit is contained in:
parent
d595b73f28
commit
c361a36e41
|
@ -50,15 +50,15 @@ searchFile m filename
|
||||||
let currentFile = csCurrentFile cs
|
let currentFile = csCurrentFile cs
|
||||||
let possibilities = joinPath currentFile filename
|
let possibilities = joinPath currentFile filename
|
||||||
: [dir ++ "/" ++ filename | dir <- csSearchPath cs]
|
: [dir ++ "/" ++ filename | dir <- csSearchPath cs]
|
||||||
openOneOf possibilities
|
openOneOf possibilities possibilities
|
||||||
where
|
where
|
||||||
openOneOf :: [String] -> PassM (Handle, String)
|
openOneOf :: [String] -> [String] -> PassM (Handle, String)
|
||||||
openOneOf [] = dieP m $ "Unable to find " ++ filename
|
openOneOf all [] = dieP m $ "Unable to find " ++ filename ++ " tried: " ++ show all
|
||||||
openOneOf (fn:fns)
|
openOneOf all (fn:fns)
|
||||||
= do r <- liftIO $ maybeIO $ openFile fn ReadMode
|
= do r <- liftIO $ maybeIO $ openFile fn ReadMode
|
||||||
case r of
|
case r of
|
||||||
Just h -> return (h, fn)
|
Just h -> return (h, fn)
|
||||||
Nothing -> openOneOf fns
|
Nothing -> openOneOf all fns
|
||||||
|
|
||||||
-- | Preprocess a file and return its tokenised form ready for parsing.
|
-- | Preprocess a file and return its tokenised form ready for parsing.
|
||||||
preprocessFile :: Meta -> String -> PassM [Token]
|
preprocessFile :: Meta -> String -> PassM [Token]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user