In rebasePath, check for absolute paths two ways.

isAbsolute from FilePath doesn't return True on Windows
for paths beginning with `/`, so we check that separately.
This commit is contained in:
John MacFarlane 2021-05-29 14:41:28 -07:00
parent c210b98366
commit 0d7103de7e

View file

@ -1924,7 +1924,10 @@ rebasePath :: SourcePos -> Text -> Text
rebasePath pos path = do rebasePath pos path = do
let fp = sourceName pos let fp = sourceName pos
isFragment = T.take 1 path == "#" isFragment = T.take 1 path == "#"
in if T.null path || isFragment || isAbsolute (T.unpack path) || isURI path -- check for leading / because on Windows this won't be
-- recognized as absolute by isAbsolute
isAbsolutePath = isAbsolute (T.unpack path) || T.take 1 path == "/"
in if T.null path || isFragment || isAbsolutePath || isURI path
then path then path
else else
case takeDirectory fp of case takeDirectory fp of