lib: expand current directory separately from filepath

We will need the current directory as an absolute path when
adding glob patterns in a few commits time.
This commit is contained in:
Joseph Weston 2018-07-23 11:14:47 +02:00 committed by Simon Michael
parent 9e56ad24e2
commit 52da073828

View File

@ -193,9 +193,11 @@ includedirectivep = do
parentpos <- getPosition
curdir <- lift $ expandPath (takeDirectory $ sourceName parentpos) ""
`orRethrowIOError` (show parentpos ++ " locating " ++ filename)
-- </> correctly handles case when 'filename' is absolute
let filepath = curdir </> filename
-- read child input
let curdir = takeDirectory (sourceName parentpos)
filepath <- lift $ expandPath curdir filename `orRethrowIOError` (show parentpos ++ " locating " ++ filename)
childInput <- lift $ readFilePortably filepath `orRethrowIOError` (show parentpos ++ " reading " ++ filepath)
-- save parent state