(path: string)
| 24 | * Uses `open` on macOS, `explorer` on Windows, `xdg-open` on Linux. |
| 25 | */ |
| 26 | export async function openPath(path: string): Promise<boolean> { |
| 27 | try { |
| 28 | const platform = process.platform |
| 29 | if (platform === 'win32') { |
| 30 | const { code } = await execFileNoThrow('explorer', [path]) |
| 31 | return code === 0 |
| 32 | } |
| 33 | const command = platform === 'darwin' ? 'open' : 'xdg-open' |
| 34 | const { code } = await execFileNoThrow(command, [path]) |
| 35 | return code === 0 |
| 36 | } catch (_) { |
| 37 | return false |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | export async function openBrowser(url: string): Promise<boolean> { |
| 42 | try { |
no test coverage detected