From 7a15d2d04bee7866a9f52113d5dd2be56102bac0 Mon Sep 17 00:00:00 2001 From: Neelesh Chandola Date: Fri, 2 Nov 2018 23:25:53 +0530 Subject: [PATCH] Fixes #9556 (#9604) [backport] --- compiler/msgs.nim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/msgs.nim b/compiler/msgs.nim index dee1081f90..4ac5a839d0 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -190,10 +190,13 @@ template toFullPath*(conf: ConfigRef; info: TLineInfo): string = proc toMsgFilename*(conf: ConfigRef; info: TLineInfo): string = if info.fileIndex.int32 < 0: result = "???" - elif optListFullPaths in conf.globalOptions: - result = conf.m.fileInfos[info.fileIndex.int32].fullPath.string + return + let absPath = conf.m.fileInfos[info.fileIndex.int32].fullPath.string + let relPath = conf.m.fileInfos[info.fileIndex.int32].projPath.string + if optListFullPaths in conf.globalOptions: + result = absPath else: - result = conf.m.fileInfos[info.fileIndex.int32].projPath.string + result = if absPath.len < relPath.len: absPath else: relPath proc toLinenumber*(info: TLineInfo): int {.inline.} = result = int info.line