(dir: string, linked: boolean)
| 508 | const desired = new Map<string, string>(); |
| 509 | const recursive = supportsRecursiveWatch(); |
| 510 | const walk = (dir: string, linked: boolean): void => { |
| 511 | if (this.shouldIgnoreDir(dir)) return; |
| 512 | let real: string; |
| 513 | try { |
| 514 | real = fs.realpathSync(dir); |
| 515 | if (this.visitedRealDirs.has(real)) return; |
| 516 | this.visitedRealDirs.add(real); |
| 517 | directories.set(dir, real); |
| 518 | if (!recursive || linked) desired.set(dir, real); |
| 519 | for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { |
| 520 | const child = path.join(dir, entry.name); |
| 521 | if (entry.isDirectory()) { |
| 522 | walk(child, false); |
| 523 | } else if (entry.isSymbolicLink()) { |
| 524 | // Follow directory symlinks just like the indexer's walk. Realpath |
| 525 | // deduplication includes ordinary directories and the root itself. |
| 526 | try { |
| 527 | if (fs.statSync(child).isDirectory()) walk(child, true); |
| 528 | } catch { /* broken link */ } |
| 529 | } |
| 530 | } |
| 531 | } catch { /* removed or unreadable directory */ } |
| 532 | }; |
| 533 | walk(this.projectRoot, false); |
| 534 | this.knownDirs = directories; |
| 535 | for (const dir of this.dirWatchers.keys()) { |
no test coverage detected