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

Function isProtocolHandlerCurrent

src/utils/deepLink/registerProtocol.ts:263–290  ·  view source on GitHub ↗
(
  claudePath: string,
)

Source from the content-addressed store, hash-verified

261 * Any read error (ENOENT, EACCES, reg nonzero) → false → re-register.
262 */
263export async function isProtocolHandlerCurrent(
264 claudePath: string,
265): Promise<boolean> {
266 try {
267 switch (process.platform) {
268 case 'darwin': {
269 const target = await fs.readlink(MACOS_SYMLINK_PATH)
270 return target === claudePath
271 }
272 case 'linux': {
273 const content = await fs.readFile(linuxDesktopPath(), 'utf8')
274 return content.includes(linuxExecLine(claudePath))
275 }
276 case 'win32': {
277 const { stdout, code } = await execFileNoThrow(
278 'reg',
279 ['query', WINDOWS_COMMAND_KEY, '/ve'],
280 { useCwd: false },
281 )
282 return code === 0 && stdout.includes(windowsCommandValue(claudePath))
283 }
284 default:
285 return false
286 }
287 } catch {
288 return false
289 }
290}
291
292/**
293 * Auto-register the claude-cli:// deep link protocol handler when missing

Callers 1

Calls 5

linuxDesktopPathFunction · 0.85
linuxExecLineFunction · 0.85
execFileNoThrowFunction · 0.85
windowsCommandValueFunction · 0.85
readFileMethod · 0.80

Tested by

no test coverage detected