diff --git a/packages/desktop/src/index.tsx b/packages/desktop/src/index.tsx index 875c0bcd60..b8965b9f4f 100644 --- a/packages/desktop/src/index.tsx +++ b/packages/desktop/src/index.tsx @@ -70,12 +70,16 @@ const createPlatform = (): Platform => { })() const wslHome = async () => { - if (os !== "windows" || !window.__OPENCODE__?.wsl) return undefined + if (os !== "windows") return undefined + const wsl = await commands.getWslConfig().catch(() => null) + if (!wsl?.enabled) return undefined return commands.wslPath("~", "windows").catch(() => undefined) } const handleWslPicker = async (result: T | null): Promise => { - if (!result || !window.__OPENCODE__?.wsl) return result + if (!result) return result + const wsl = await commands.getWslConfig().catch(() => null) + if (!wsl?.enabled) return result if (Array.isArray(result)) { return Promise.all(result.map((path) => commands.wslPath(path, "linux").catch(() => path))) as any } @@ -343,16 +347,6 @@ const createPlatform = (): Platform => { } }, - getWslEnabled: async () => { - const next = await commands.getWslConfig().catch(() => null) - if (next) return next.enabled - return window.__OPENCODE__!.wsl ?? false - }, - - setWslEnabled: async (enabled) => { - await commands.setWslConfig({ enabled }) - }, - getDefaultServer: async () => { const url = await commands.getDefaultServerUrl().catch(() => null) if (!url) return null