MCPcopy Create free account
hub / github.com/Noumena-Network/code / getInstallationPath

Function getInstallationPath

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

Source from the content-addressed store, hash-verified

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

Callers 1

getDoctorDiagnosticFunction · 0.70

Calls 4

isDevelopmentLikeBuildFunction · 0.85
getCwdFunction · 0.85
isInBundledModeFunction · 0.85
getFsImplementationFunction · 0.85

Tested by

no test coverage detected