[READ-ONLY] Mirror of https://github.com/SantaClaas/gigit. git client
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728/** * Choosing a repository folder. * * Wrapped so the rest of the app never imports the dialog plugin directly — * which also means the tests can stand in for it in one place. */
import { open } from "@tauri-apps/plugin-dialog";
/** * Ask for a repository folder. * * Resolves to `undefined` when the dialog is dismissed, which is an ordinary * outcome rather than an error. Any folder inside a repository will do: the * Rust side searches upwards the way git does. */export async function chooseRepositoryFolder(): Promise<string | undefined> { const chosen = await open({ directory: true, multiple: false, title: "Open repository", });
// The plugin returns null on dismissal, and an array only when `multiple` // is set — which it is not. return typeof chosen === "string" ? chosen : undefined;}