--filenames:abs|canonical|legacyRelProj for filenames in compiler msgs (replaces --listfullpaths:on|off) (#17746)
* use canonicalImport for filename_magicSauce * --filenames:abs|canonical|magic * rename: magic => legacyRelProj
This commit is contained in:
parent
c631648cb3
commit
da1c1a7117
9 changed files with 72 additions and 41 deletions
|
|
@ -63,21 +63,6 @@ proc prettyString(a: object): string =
|
|||
for k, v in fieldPairs(a):
|
||||
result.add k & ": " & $v & "\n"
|
||||
|
||||
proc canonicalImport*(conf: ConfigRef, file: AbsoluteFile): string =
|
||||
##[
|
||||
Shows the canonical module import, e.g.:
|
||||
system, std/tables, fusion/pointers, system/assertions, std/private/asciitables
|
||||
]##
|
||||
var ret = getRelativePathFromConfigPath(conf, file, isTitle = true)
|
||||
let dir = getNimbleFile(conf, $file).parentDir.AbsoluteDir
|
||||
if not dir.isEmpty:
|
||||
let relPath = relativeTo(file, dir)
|
||||
if not relPath.isEmpty and (ret.isEmpty or relPath.string.len < ret.string.len):
|
||||
ret = relPath
|
||||
if ret.isEmpty:
|
||||
ret = relativeTo(file, conf.projectPath)
|
||||
result = ret.string.nativeToUnixPath.changeFileExt("")
|
||||
|
||||
proc presentationPath*(conf: ConfigRef, file: AbsoluteFile): RelativeFile =
|
||||
## returns a relative file that will be appended to outDir
|
||||
let file2 = $file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue