make tcompilerapi green, don't assue projectPath exists
This commit is contained in:
parent
0cb72185ae
commit
ed5d2b5505
1 changed files with 8 additions and 5 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue