MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getInstallationPath

Function getInstallationPath

src/utils/doctorDiagnostic.ts:150–189  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

148}
149
150async function getInstallationPath(): Promise<string> {
151 if (process.env.NODE_ENV === 'development') {
152 return getCwd()
153 }
154
155 // For bundled/native builds, show the binary location
156 if (isInBundledMode()) {
157 // Try to find the actual binary that was invoked
158 try {
159 return await realpath(process.execPath)
160 } catch {
161 // This function doesn't expect errors
162 }
163
164 try {
165 const path = await which('claude')
166 if (path) {
167 return path
168 }
169 } catch {
170 // This function doesn't expect errors
171 }
172
173 // If we can't find it, check common locations
174 try {
175 await getFsImplementation().stat(join(homedir(), '.local/bin/claude'))
176 return join(homedir(), '.local/bin/claude')
177 } catch {
178 // Not found
179 }
180 return 'native'
181 }
182
183 // For npm installations, use the path of the executable
184 try {
185 return process.argv[0] || 'unknown'
186 } catch {
187 return 'unknown'
188 }
189}
190
191export function getInvokedBinary(): string {
192 try {

Callers 1

getDoctorDiagnosticFunction · 0.70

Calls 3

getCwdFunction · 0.85
isInBundledModeFunction · 0.85
getFsImplementationFunction · 0.85

Tested by

no test coverage detected