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