diff --git a/compiler/msgs.nim b/compiler/msgs.nim index a8bf1bfc87f1b..371f00ba4f275 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -254,14 +254,10 @@ proc toFilenameOption*(conf: ConfigRef, fileIdx: FileIndex, opt: FilenameOption) of foRelProject: result = toProjPath(conf, fileIdx) of foMagicSauce: let absPath = toFullPath(conf, fileIdx) - result = canonicalImport(conf, absPath.AbsoluteFile) - # relPath = toProjPath(conf, fileIdx) - # result = if (optListFullPaths in conf.globalOptions) or - # (relPath.len > absPath.len) or - # (relPath.count("..") > 2): - # absPath - # else: - # relPath + if optListFullPaths in conf.globalOptions: + result = absPath + else: + result = canonicalImportAux(conf, absPath.AbsoluteFile) of foName: result = toProjPath(conf, fileIdx).lastPathPart of foStacktrace: if optExcessiveStackTrace in conf.globalOptions: diff --git a/compiler/options.nim b/compiler/options.nim index 5fb471d683964..5c48eae839c35 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -885,7 +885,7 @@ proc findProjectNimFile*(conf: ConfigRef; pkg: string): string = if dir == "": break return "" -proc canonicalImport*(conf: ConfigRef, file: AbsoluteFile): string = +proc canonicalImportAux*(conf: ConfigRef, file: AbsoluteFile): string = ##[ Shows the canonical module import, e.g.: system, std/tables, fusion/pointers, system/assertions, std/private/asciitables @@ -898,6 +898,10 @@ proc canonicalImport*(conf: ConfigRef, file: AbsoluteFile): string = ret = relPath if ret.isEmpty: ret = relativeTo(file, conf.projectPath) + result = ret.string + +proc canonicalImport*(conf: ConfigRef, file: AbsoluteFile): string = + let ret = canonicalImportAux(conf, file) result = ret.string.nativeToUnixPath.changeFileExt("") proc canonDynlibName(s: string): string =