(filePath: string)
| 563 | * case-insensitive comparison. |
| 564 | */ |
| 565 | export function normalizePathForComparison(filePath: string): string { |
| 566 | // Use path.normalize() to clean up redundant separators and resolve . and .. |
| 567 | let normalized = normalize(filePath) |
| 568 | |
| 569 | // On Windows, normalize for case-insensitive comparison: |
| 570 | // - Convert forward slashes to backslashes (path.normalize only does this on actual Windows) |
| 571 | // - Convert to lowercase (Windows paths are case-insensitive) |
| 572 | if (getPlatform() === 'windows') { |
| 573 | normalized = normalized.replace(/\//g, '\\').toLowerCase() |
| 574 | } |
| 575 | |
| 576 | return normalized |
| 577 | } |
| 578 | |
| 579 | /** |
| 580 | * Compare two file paths for equality, handling Windows case-insensitivity. |
no test coverage detected