fix(electrobun): fix PathBrowser process.env.HOME, add dual browse buttons

- PathBrowser: resolveHome() via files.homeDir RPC (was process.env.HOME)
- ProjectWizard: two browse buttons — 📂 native dialog + 🔍 in-app browser
- In-app browser uses display toggle (rule 55), dirs-only filter
- Native dialog: Electrobun Utils.openFileDialog (GTK chooser)
- In-app browser: themed, dirs sorted first, proper breadcrumbs
This commit is contained in:
Hibryda 2026-03-22 11:48:47 +01:00
parent bfc63bb595
commit 46b4893d2d
2 changed files with 20 additions and 2 deletions

View file

@ -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<string> {
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;