diff --git a/ui-electrobun/src/mainview/PathBrowser.svelte b/ui-electrobun/src/mainview/PathBrowser.svelte index 75fcdbf..07303a7 100644 --- a/ui-electrobun/src/mainview/PathBrowser.svelte +++ b/ui-electrobun/src/mainview/PathBrowser.svelte @@ -9,7 +9,7 @@ let { onSelect, onClose }: Props = $props(); - const HOME = '/home/' + (typeof window !== 'undefined' ? '' : ''); + let HOME = $state('/home'); const SHORTCUTS = [ { label: 'Home', path: '~' }, { label: 'Desktop', path: '~/Desktop' }, @@ -40,11 +40,22 @@ entries.filter(e => e.type === 'dir' && (filter === '' || e.name.toLowerCase().includes(filter.toLowerCase()))) ); + // Load home dir from backend on first use + async function resolveHome(): Promise { + if (HOME !== '/home') return HOME; + try { + const r = await appRpc.request['files.homeDir']({}); + if (r?.path) HOME = r.path; + } catch {} + return HOME; + } + async function loadDir(dirPath: string) { loading = true; error = ''; try { - const expandedPath = dirPath.replace(/^~/, process.env.HOME ?? '/home'); + const home = await resolveHome(); + const expandedPath = dirPath.replace(/^~/, home); const result = await appRpc.request['files.list']({ path: expandedPath }); if (result?.error) { error = result.error; diff --git a/ui-electrobun/src/mainview/ProjectWizard.svelte b/ui-electrobun/src/mainview/ProjectWizard.svelte index 7008787..9119403 100644 --- a/ui-electrobun/src/mainview/ProjectWizard.svelte +++ b/ui-electrobun/src/mainview/ProjectWizard.svelte @@ -293,13 +293,20 @@ bind:value={localPath} oninput={() => validatePath(localPath)} /> + {#if pathValid !== 'idle'} {validationIcon(pathValid)} {/if} +
+ showBrowser = false} /> +
{#if pathValid === 'valid' && isGitRepo} {t('wizard.step1.gitDetected' as any)} ({gitBranch}) {/if}