* One path is a prefix of the other. Special-cases root (normalize('/') + sep * = '//'). Case-insensitive on win32 since normalize() doesn't lowercase * drive letters and CLAUDE_CODE_PLUGIN_CACHE_DIR may disagree with resolved.
(a: string, b: string)
| 97 | * drive letters and CLAUDE_CODE_PLUGIN_CACHE_DIR may disagree with resolved. |
| 98 | */ |
| 99 | function pathsOverlap(a: string, b: string): boolean { |
| 100 | const na = normalizeForCompare(a) |
| 101 | const nb = normalizeForCompare(b) |
| 102 | return ( |
| 103 | na === nb || |
| 104 | na === sep || |
| 105 | nb === sep || |
| 106 | na.startsWith(nb + sep) || |
| 107 | nb.startsWith(na + sep) |
| 108 | ) |
| 109 | } |
| 110 | |
| 111 | function normalizeForCompare(p: string): string { |
| 112 | const n = normalize(p) |
no test coverage detected