(currentPath?: string)
| 41 | } |
| 42 | |
| 43 | buildExtendedPath(currentPath?: string): string { |
| 44 | const config = this.getPathConfig() |
| 45 | const existingPaths = currentPath |
| 46 | ? currentPath.split(config.separator).filter(Boolean) |
| 47 | : [] |
| 48 | |
| 49 | const allPaths = [ |
| 50 | ...config.commonPaths, |
| 51 | config.localBin, |
| 52 | ...config.packageManagerPaths, |
| 53 | ] |
| 54 | |
| 55 | // Add paths that aren't already present (case-insensitive on Windows) |
| 56 | const isWindows = this.platform === "win32" |
| 57 | const normalizedExisting = new Set( |
| 58 | existingPaths.map((p) => |
| 59 | isWindows ? path.normalize(p).toLowerCase() : path.normalize(p) |
| 60 | ) |
| 61 | ) |
| 62 | |
| 63 | const newPaths: string[] = [] |
| 64 | for (const p of allPaths) { |
| 65 | const normalized = isWindows |
| 66 | ? path.normalize(p).toLowerCase() |
| 67 | : path.normalize(p) |
| 68 | if (!normalizedExisting.has(normalized)) { |
| 69 | newPaths.push(path.normalize(p)) |
| 70 | normalizedExisting.add(normalized) |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | return [...newPaths, ...existingPaths].join(config.separator) |
| 75 | } |
| 76 | |
| 77 | getDefaultShell(): string { |
| 78 | const config = this.getShellConfig() |
no test coverage detected