diff options
| author | Brendan Allan <[email protected]> | 2026-02-27 14:17:24 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-27 06:17:24 +0000 |
| commit | 0da8af8a28658d155646725a4b1190cb7bd15784 (patch) | |
| tree | 96f95c3c52cc12a26e298c0a09c283de8a91fa40 /packages/desktop/src/index.tsx | |
| parent | 2a4ed495515ff6470f08e628350d4fe55272f4d3 (diff) | |
| download | opencode-0da8af8a28658d155646725a4b1190cb7bd15784.tar.gz opencode-0da8af8a28658d155646725a4b1190cb7bd15784.zip | |
desktop: move open_path to rust (#15323)
Diffstat (limited to 'packages/desktop/src/index.tsx')
| -rw-r--r-- | packages/desktop/src/index.tsx | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/packages/desktop/src/index.tsx b/packages/desktop/src/index.tsx index 188a37eb8..17b4638bd 100644 --- a/packages/desktop/src/index.tsx +++ b/packages/desktop/src/index.tsx @@ -17,7 +17,6 @@ import { getCurrent, onOpenUrl } from "@tauri-apps/plugin-deep-link" import { open, save } from "@tauri-apps/plugin-dialog" import { fetch as tauriFetch } from "@tauri-apps/plugin-http" import { isPermissionGranted, requestPermission } from "@tauri-apps/plugin-notification" -import { openPath as openerOpenPath } from "@tauri-apps/plugin-opener" import { type as ostype } from "@tauri-apps/plugin-os" import { relaunch } from "@tauri-apps/plugin-process" import { open as shellOpen } from "@tauri-apps/plugin-shell" @@ -116,29 +115,7 @@ const createPlatform = (): Platform => { void shellOpen(url).catch(() => undefined) }, async openPath(path: string, app?: string) { - const os = ostype() - if (os === "windows") { - const resolvedPath = await (async () => { - if (window.__OPENCODE__?.wsl) { - const converted = await commands.wslPath(path, "windows").catch(() => null) - if (converted) return converted - } - - return path - })() - const resolvedApp = (app && (await commands.resolveAppPath(app))) || app - const isPowershell = (value?: string) => { - if (!value) return false - const name = value.toLowerCase().replaceAll("/", "\\").split("\\").pop() - return name === "powershell" || name === "powershell.exe" - } - if (isPowershell(resolvedApp)) { - await commands.openInPowershell(resolvedPath) - return - } - return openerOpenPath(resolvedPath, resolvedApp) - } - return openerOpenPath(path, app) + await commands.openPath(path, app ?? null) }, back() { |
