(dir: string, linked: boolean)
| 490 | const desired = new Map<string, string>(); |
| 491 | const recursive = supportsRecursiveWatch(); |
| 492 | const walk = (dir: string, linked: boolean): void => { |
| 493 | if (this.shouldIgnoreDir(dir)) return; |
| 494 | let real: string; |
| 495 | try { |
| 496 | real = fs.realpathSync(dir); |
| 497 | if (this.visitedRealDirs.has(real)) return; |
| 498 | this.visitedRealDirs.add(real); |
| 499 | directories.set(dir, real); |
| 500 | if (!recursive || linked) desired.set(dir, real); |
| 501 | for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { |
| 502 | const child = path.join(dir, entry.name); |
| 503 | if (entry.isDirectory()) { |
| 504 | walk(child, false); |
| 505 | } else if (entry.isSymbolicLink()) { |
| 506 | // Follow directory symlinks just like the indexer's walk. Realpath |
| 507 | // deduplication includes ordinary directories and the root itself. |
| 508 | try { |
| 509 | if (fs.statSync(child).isDirectory()) walk(child, true); |
| 510 | } catch { /* broken link */ } |
| 511 | } |
| 512 | } |
| 513 | } catch { /* removed or unreadable directory */ } |
| 514 | }; |
| 515 | walk(this.projectRoot, false); |
| 516 | this.knownDirs = directories; |
| 517 | for (const dir of this.dirWatchers.keys()) { |
no test coverage detected