дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 01:31:41 +02:00
choosePath, a thin wrapper over the platform file/folder dialog, lived in features/settings/languages/api.ts, so vcs/RevisionBrowser imported the settings feature to open a folder picker. It moves to platform/choosePath.ts unchanged (the dialog module still loads lazily). No behaviour change. Co-authored-by: Mr0Bread <[email protected]>
20 рядки
662 B
TypeScript
20 рядки
662 B
TypeScript
import { isTauri } from "@/platform/ipc";
|
|
|
|
/** File / folder chooser (Tauri dialog); null when cancelled or outside Tauri. */
|
|
export async function choosePath(opts: {
|
|
directory: boolean;
|
|
title: string;
|
|
defaultPath?: string;
|
|
}): Promise<string | null> {
|
|
if (!isTauri()) return null;
|
|
// Lazy on purpose: loading platform/dialog starts its GTK capability probe at module load.
|
|
const { open } = await import("@/platform/dialog");
|
|
const picked = await open({
|
|
directory: opts.directory,
|
|
multiple: false,
|
|
title: opts.title,
|
|
defaultPath: opts.defaultPath || undefined,
|
|
});
|
|
return (Array.isArray(picked) ? picked[0] : picked) ?? null;
|
|
}
|