Skip to content

Commit a160eb7

Browse files
committed
fix(desktop): homedir aware path on home
1 parent e4b2028 commit a160eb7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

packages/desktop/src/context/global-sync.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ export const { use: useGlobalSync, provider: GlobalSyncProvider } = createSimple
5555
const globalSDK = useGlobalSDK()
5656
const [globalStore, setGlobalStore] = createStore<{
5757
ready: boolean
58+
path: Path
5859
project: Project[]
5960
provider: ProviderListResponse
6061
provider_auth: ProviderAuthResponse
6162
children: Record<string, State>
6263
}>({
6364
ready: false,
65+
path: { state: "", config: "", worktree: "", directory: "", home: "" },
6466
project: [],
6567
provider: { all: [], connected: [], default: {} },
6668
provider_auth: {},
@@ -224,6 +226,9 @@ export const { use: useGlobalSync, provider: GlobalSyncProvider } = createSimple
224226

225227
async function bootstrap() {
226228
return Promise.all([
229+
globalSDK.client.path.get().then((x) => {
230+
setGlobalStore("path", x.data!)
231+
}),
227232
globalSDK.client.project.list().then(async (x) => {
228233
setGlobalStore(
229234
"project",

packages/desktop/src/pages/home.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useGlobalSync } from "@/context/global-sync"
2-
import { For, Match, Show, Switch } from "solid-js"
2+
import { createMemo, For, Match, Show, Switch } from "solid-js"
33
import { Button } from "@opencode-ai/ui/button"
44
import { Logo } from "@opencode-ai/ui/logo"
55
import { useLayout } from "@/context/layout"
@@ -14,6 +14,7 @@ export default function Home() {
1414
const layout = useLayout()
1515
const platform = usePlatform()
1616
const navigate = useNavigate()
17+
const homedir = createMemo(() => sync.data.path.home)
1718

1819
function openProject(directory: string) {
1920
layout.projects.open(directory)
@@ -61,7 +62,7 @@ export default function Home() {
6162
class="text-14-mono text-left justify-between px-3"
6263
onClick={() => openProject(project.worktree)}
6364
>
64-
{project.worktree}
65+
{project.worktree.replace(homedir(), "~")}
6566
<div class="text-14-regular text-text-weak">
6667
{DateTime.fromMillis(project.time.updated ?? project.time.created).toRelative()}
6768
</div>

0 commit comments

Comments
 (0)