Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

tweidinger
Copy link
Contributor

Fixes #2567 by adding an explanation note to the plugin usage docs.

@tweidinger tweidinger requested a review from a team as a code owner August 26, 2024 03:40
Copy link

netlify bot commented Aug 26, 2024

Deploy Preview for tauri-v2 ready!

Name Link
🔨 Latest commit 8a63c11
🔍 Latest deploy log https://app.netlify.com/sites/tauri-v2/deploys/66cd51f9207d0a0008160ce7
😎 Deploy Preview https://deploy-preview-2590--tauri-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 99 (🔴 down 1 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@tweidinger tweidinger requested a review from FabianLars August 26, 2024 03:40
:::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
Copy link
Member

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.

Copy link
Contributor Author

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?

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

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

@tweidinger tweidinger closed this Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[request] File System guide missing rust instructions
3 participants