* Opens a deep link URL using the platform-specific mechanism. * Returns true if the command succeeded, false otherwise.
(deepLinkUrl: string)
| 166 | * Returns true if the command succeeded, false otherwise. |
| 167 | */ |
| 168 | async function openDeepLink(deepLinkUrl: string): Promise<boolean> { |
| 169 | const platform = process.platform |
| 170 | logForDebugging(`Opening deep link: ${deepLinkUrl}`) |
| 171 | |
| 172 | if (platform === 'darwin') { |
| 173 | if (isDevMode()) { |
| 174 | // In dev mode, `open` launches a bare Electron binary (without app code) |
| 175 | // because setAsDefaultProtocolClient registers just the Electron executable. |
| 176 | // Use AppleScript to route the URL to the already-running Electron app. |
| 177 | const { code } = await execFileNoThrow('osascript', [ |
| 178 | '-e', |
| 179 | `tell application "Electron" to open location "${deepLinkUrl}"`, |
| 180 | ]) |
| 181 | return code === 0 |
| 182 | } |
| 183 | const { code } = await execFileNoThrow('open', [deepLinkUrl]) |
| 184 | return code === 0 |
| 185 | } else if (platform === 'linux') { |
| 186 | const { code } = await execFileNoThrow('xdg-open', [deepLinkUrl]) |
| 187 | return code === 0 |
| 188 | } else if (platform === 'win32') { |
| 189 | // On Windows, use cmd /c start to open URLs |
| 190 | const { code } = await execFileNoThrow('cmd', [ |
| 191 | '/c', |
| 192 | 'start', |
| 193 | '', |
| 194 | deepLinkUrl, |
| 195 | ]) |
| 196 | return code === 0 |
| 197 | } |
| 198 | |
| 199 | return false |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Build and open a deep link to resume the current session in Claude Desktop. |
no test coverage detected