Fix tsc-wrapped flattenOutDir() for Windows.
PiperOrigin-RevId: 186360327
diff --git a/internal/tsc_wrapped/compiler_host.ts b/internal/tsc_wrapped/compiler_host.ts
index 5bb033d..d52f91d 100644
--- a/internal/tsc_wrapped/compiler_host.ts
+++ b/internal/tsc_wrapped/compiler_host.ts
@@ -119,9 +119,10 @@
}
for (const dir of this.relativeRoots) {
- if (result.startsWith(dir + '/')) {
- // relativeRoots[i]/path/to/file -> path/to/file
- result = path.relative(dir, result);
+ // relativeRoots[i]/path/to/file -> path/to/file
+ const rel = path.relative(dir, result);
+ if (!rel.startsWith('..')) {
+ result = rel;
// relativeRoots is sorted longest first so we can short-circuit
// after the first match
break;