-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Clarify FS Plugin Rust Side Exposure #2590
Conversation
✅ Deploy Preview for tauri-v2 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
:::note[Rust Exposure] | ||
|
||
The exposed API on the Rust side is mostly intended to manipulate the [Scope](#scopes) of the plugin. | ||
It does expose some APIs to access the file system on mobile, but the recommendation is to use [`tokio::fs`](https://docs.rs/tokio/latest/tokio/fs/index.html) or the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Android the tokio or std APIs won't work if you're using e.g. the dialog API (which returns a content:// URI instead of a path to the file). We might also need more changes for iOS to properly request for permissions to access some files (for instance photos, or the Files location).
I think in the end when the FS plugin is marked as stable, we'll recommend using it even for Rust code unless your app is desktop-only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:flip-table: 😂
Alright, so we recommend std/tokio for desktop and our api for mobile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll fallback to std for desktop, so if you need cross platform support for e.g. reading resources and dialog-selected files, you need to use our own API wrapper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so I think we should skip this note and also document the Rust API instead
Fixes #2567 by adding an explanation note to the plugin usage docs.