fix commonPrefix handling
This commit is contained in:
parent
1a05f13aef
commit
95494efe50
1 changed files with 8 additions and 5 deletions
|
@ -407,18 +407,17 @@ namespace ts {
|
|||
// directory: /a/b/c/d/e
|
||||
// resolvedFileName: /a/b/foo.d.ts
|
||||
const commonPrefix = getCommonPrefix(path, resolvedFileName);
|
||||
if (commonPrefix === undefined) {
|
||||
return;
|
||||
}
|
||||
let current = path;
|
||||
while (true) {
|
||||
while (current !== commonPrefix) {
|
||||
const parent = getDirectoryPath(current);
|
||||
if (parent === current || directoryPathMap.has(parent)) {
|
||||
break;
|
||||
}
|
||||
directoryPathMap.set(parent, result);
|
||||
current = parent;
|
||||
|
||||
if (current === commonPrefix) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,6 +433,10 @@ namespace ts {
|
|||
i++;
|
||||
}
|
||||
|
||||
if (i === directory.length && resolutionDirectory.length > i && resolutionDirectory[i] === directorySeparator) {
|
||||
return directory;
|
||||
}
|
||||
|
||||
// find last directory separator before position i
|
||||
const sep = directory.lastIndexOf(directorySeparator, i);
|
||||
if (sep < 0) {
|
||||
|
|
Loading…
Reference in a new issue