Fix bug: Check for both "./" and ".\" (#21730)

* Fix bug: Check for both "./" and ".\"

* Use normalizeSlashes
This commit is contained in:
Andy 2018-02-07 10:50:49 -08:00 committed by GitHub
parent 3b1a3f8a4d
commit d35d5d0793
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -462,7 +462,7 @@ namespace ts.Completions.PathCompletions {
}
function normalizeAndPreserveTrailingSlash(path: string) {
if (path === "./") {
if (normalizeSlashes(path) === "./") {
// normalizePath turns "./" into "". "" + "/" would then be a rooted path instead of a relative one, so avoid this particular case.
// There is no problem for adding "/" to a non-empty string -- it's only a problem at the beginning.
return "";