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

@ -389,6 +389,19 @@ block ospaths:
doAssert joinPath("foo", "./") == unixToNativePath"foo/"
doAssert joinPath("foo", "", "bar/") == unixToNativePath"foo/bar/"
# issue #13579
doAssert joinPath("/foo", "../a") == unixToNativePath"/a"
doAssert joinPath("/foo/", "../a") == unixToNativePath"/a"
doAssert joinPath("/foo/.", "../a") == unixToNativePath"/a"
doAssert joinPath("/foo/.b", "../a") == unixToNativePath"/foo/a"
doAssert joinPath("/foo///", "..//a/") == unixToNativePath"/a/"
doAssert joinPath("foo/", "../a") == unixToNativePath"a"
when doslikeFileSystem:
doAssert joinPath("C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\", "..\\..\\VC\\vcvarsall.bat") == r"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
doAssert joinPath("C:\\foo", "..\\a") == r"C:\a"
doAssert joinPath("C:\\foo\\", "..\\a") == r"C:\a"
block getTempDir:
block TMPDIR:
# TMPDIR env var is not used if either of these are defined.