fix #13579 joinPath("/foo/", "../a") is now /a (#13586)

This commit is contained in:
Andreas Rumpf 2020-03-05 15:31:22 +01:00 • committed by GitHub
commit 62c113ebc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 0 deletions

View file

@ -127,6 +127,7 @@ template endsWith(a: string, b: set[char]): bool =
proc joinPathImpl(result: var string, state: var int, tail: string) =
let trailingSep = tail.endsWith({DirSep, AltSep}) or tail.len == 0 and result.endsWith({DirSep, AltSep})
normalizePathEnd(result, trailingSep=false)
addNormalizePath(tail, result, state, DirSep)
normalizePathEnd(result, trailingSep=trailingSep)