summary refs log tree commit diff stats
path: root/compiler/msgs.nim
diff options
context:
space:
mode:
authorMiran <narimiran@disroot.org>2019-01-24 14:40:16 +0100
committerGitHub <noreply@github.com>2019-01-24 14:40:16 +0100
commit251b014bf4b1cdd0d79511ab4a140db301925d0b (patch)
tree0bf08646b980965a1affcdade7847e56f396c364 /compiler/msgs.nim
parente75049d7b63d0527b4d66dbf50380a3736571c52 (diff)
downloadNim-251b014bf4b1cdd0d79511ab4a140db301925d0b.tar.gz
fix #9556 (#10445)
The old logic wasn't very useful because
`relPath` is almost always shorter than `absPath`,
e.g. `../../../../../` is shorter than `C:\Program Files`.

This way allows the usage of a relative path for
at most two levels deep, e.g. `../../relPath`,
otherwise the absolute path is used.
Diffstat (limited to 'compiler/msgs.nim')
-rw-r--r--compiler/msgs.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index 698b81061..6bb2c3fa3 100644
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -203,7 +203,7 @@ proc toMsgFilename*(conf: ConfigRef; info: TLineInfo): string =
     result = absPath
   else:
     let relPath = conf.m.fileInfos[info.fileIndex.int32].projPath.string
-    result = if absPath.len < relPath.len: absPath else: relPath
+    result = if relPath.count("..") > 2: absPath else: relPath
 
 proc toLinenumber*(info: TLineInfo): int {.inline.} =
   result = int info.line