From ed5d2b55053db24e1c14095e08292d7b0b3dcff5 Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 14 Sep 2018 19:30:02 +0200 Subject: [PATCH] make tcompilerapi green, don't assue projectPath exists --- compiler/pragmas.nim | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 146c35fd99..e6e4eff38f 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -583,11 +583,14 @@ proc pragmaLine(c: PContext, n: PNode) = elif y.kind != nkIntLit: localError(c.config, n.info, errIntLiteralExpected) else: - # XXX check if paths are properly resolved this way: - let dir = toFullPath(c.config, n.info).splitFile.dir - let rel = if isAbsolute(x.strVal): relativeTo(AbsoluteFile(x.strVal), c.config.projectPath) - else: RelativeFile(x.strVal) - n.info.fileIndex = fileInfoIdx(c.config, AbsoluteDir(dir) / rel) + 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 rel = if isAbsolute(x.strVal): relativeTo(AbsoluteFile(x.strVal), c.config.projectPath) + else: RelativeFile(x.strVal) + n.info.fileIndex = fileInfoIdx(c.config, AbsoluteDir(dir) / rel) n.info.line = uint16(y.intVal) else: localError(c.config, n.info, "tuple expected")