MCPcopy Create free account
hub / github.com/codeaashu/claude-code / detectWinget

Function detectWinget

src/utils/nativeInstaller/packageManagers.ts:133–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

131 * And creates links at: %LOCALAPPDATA%\Microsoft\WinGet\Links\
132 */
133export 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

Callers 2

packageManagers.tsFile · 0.85

Calls 2

getPlatformFunction · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected