()
| 131 | * And creates links at: %LOCALAPPDATA%\Microsoft\WinGet\Links\ |
| 132 | */ |
| 133 | export function detectWinget(): boolean { |
| 134 | const platform = getPlatform() |
| 135 | |
| 136 | // Winget is only for Windows |
| 137 | if (platform !== 'windows') { |
| 138 | return false |
| 139 | } |
| 140 | |
| 141 | const execPath = process.execPath || process.argv[0] || '' |
| 142 | |
| 143 | // Check for WinGet paths (handles both forward and backslashes) |
| 144 | const wingetPatterns = [ |
| 145 | /Microsoft[/\\]WinGet[/\\]Packages/i, |
| 146 | /Microsoft[/\\]WinGet[/\\]Links/i, |
| 147 | ] |
| 148 | |
| 149 | for (const pattern of wingetPatterns) { |
| 150 | if (pattern.test(execPath)) { |
| 151 | logForDebugging(`Detected winget installation: ${execPath}`) |
| 152 | return true |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | return false |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Detects if the currently running Claude instance was installed via pacman |
no test coverage detected