import { setRecoil } from "recoil-nexus" ; import { RemoteExplorer } from "../modules/remote_explorer" ; import { showedWindows } from "./atoms" ; export const isTauri = ( globalThis as any ) . __TAURI__ != null ; /**
 * Launches a filesystem picker, native if Tauri and web-based if not
 */ export async function openFolderPicker ( filesystem_name ) { const { dialog } = await import ( "@tauri-apps/api" ) ; if ( filesystem_name == "local" && isTauri ) { return ( await dialog . open ( { multiple : false , directory : true } ) ) as string | null ; } else { return new Promise ( ( resolve ) => { function onSelectedFolder ( folderPath ) { resolve ( folderPath ) ; } setRecoil ( showedWindows , ( val ) => [ ... val , new RemoteExplorer ( { onSelectedFolder } ) , ] ) ; } ) ; } }