/// A FILE from the phone: the document picker with the caller's own MIME /// filter, answered with a path the Rust side can open. A document already /// on this phone's storage is handed over as it lies; one that has no path /// is copied into the app's cache under its own name, and only as far as /// `max_copy_bytes` allows — zero refuses the copy, which is what a pick /// that could be hundreds of megabytes wants. #[tauri::command] async fn pick_file( app: tauri::AppHandle, mime_types: Option, max_copy_bytes: Option, ) -> Result { #[cfg(mobile)] { use tauri::Manager; let storage = app.state::>(); storage .0 .run_mobile_plugin::( "pickFile", PickFileArgs { mime_types, max_copy_bytes: max_copy_bytes.unwrap_or(0), }, ) .map_err(|e| e.to_string()) } #[cfg(not(mobile))] { let _ = (app, mime_types, max_copy_bytes); Err("the file picker here is the desktop's dialog".into()) } }