make tcompilerapi green, don't assue projectPath exists

This commit is contained in:
Araq 2018-09-14 19:30:02 +02:00
commit ed5d2b5505

View file

@ -583,7 +583,10 @@ proc pragmaLine(c: PContext, n: PNode) =
elif y.kind != nkIntLit: elif y.kind != nkIntLit:
localError(c.config, n.info, errIntLiteralExpected) localError(c.config, n.info, errIntLiteralExpected)
else: else:
# XXX check if paths are properly resolved this way: if c.config.projectPath.isEmpty:
n.info.fileIndex = fileInfoIdx(c.config, AbsoluteFile(x.strVal))
else:
# XXX this is still suspicous:
let dir = toFullPath(c.config, n.info).splitFile.dir let dir = toFullPath(c.config, n.info).splitFile.dir
let rel = if isAbsolute(x.strVal): relativeTo(AbsoluteFile(x.strVal), c.config.projectPath) let rel = if isAbsolute(x.strVal): relativeTo(AbsoluteFile(x.strVal), c.config.projectPath)
else: RelativeFile(x.strVal) else: RelativeFile(x.strVal)