fix(ivy): always convert `rootDirs` to `AbsoluteFsPath` in `getRootDirs` (#29151)

`getCurrentDirectory` directory doesn't return a posix separated normalized path. While `rootDir` and `rootDirs` should return posix separated paths, it's best to not assume as other paths within the compiler options can be returned not posix separated such as `basePath`

See: https://github.com/Microsoft/TypeScript/blob/master/src/compiler/sys.ts#L635

This partially fixes #29140, however there needs to be a change in the CLI as well to handle this, as at the moment we are leaking devkit paths which is not correct.

Fixes #29140

PR Close #29151
This commit is contained in:
Alan 2019-03-07 12:02:39 +01:00 committed by Kara Erickson
parent a5b8420234
commit ca20f571b8
1 changed files with 6 additions and 1 deletions

View File

@ -78,7 +78,12 @@ export function getRootDirs(host: ts.CompilerHost, options: ts.CompilerOptions):
} else {
rootDirs.push(host.getCurrentDirectory());
}
return rootDirs.map(rootDir => AbsoluteFsPath.fromUnchecked(rootDir));
// In Windows the above might not always return posix separated paths
// See:
// https://github.com/Microsoft/TypeScript/blob/3f7357d37f66c842d70d835bc925ec2a873ecfec/src/compiler/sys.ts#L650
// Also compiler options might be set via an API which doesn't normalize paths
return rootDirs.map(rootDir => AbsoluteFsPath.from(rootDir));
}
export function nodeDebugInfo(node: ts.Node): string {