summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/pragmas.nim13
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index 146c35fd9..e6e4eff38 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")