-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: Added initial support for dialog, path and fs plugins #68
base: v2
Are you sure you want to change the base?
Conversation
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.
Thanks! I had some questions about some implementation details. A few occurred multiple times, so I copy-pasted the comment to mark each spot I noticed it.
Also, in the future, please break up PR's into smaller chunks. i.e. This could have been broken into 3: one for each of fs
, path
, and dialog
.
src/fs.rs
Outdated
/// ``` | ||
/// | ||
/// Requires [`allowlist > fs > readDir`](https://tauri.app/v1/api/js/fs) to be enabled. | ||
pub async fn read_dir(path: &Path, dir: BaseDirectory) -> crate::Result<Vec<FileEntry>> { |
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.
It doesn't appear that readDir
gives any structure to what is read, and I don't see where you assemble the strcutre, using the children
field of FileEntry
.
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.
I am not sure if I get what is required, but I changed the ReadDirOptions
as a first step towards a solution. See 3201ccf8
If I get the API right, path
should be relative to base_dir?
src/fs.rs
Outdated
/// ``` | ||
/// | ||
/// Requires [`allowlist > fs > readDir`](https://tauri.app/v1/api/js/fs) to be enabled. | ||
pub async fn read_dir_all(path: &Path, dir: BaseDirectory) -> crate::Result<Vec<FileEntry>> { |
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.
See comments for read_dir
.
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.
As far as I can see, there is no readDirAll
function in v2? I only can find readDir
…TAURI__.core.Channel
@emirror-de Can you resolve the conversations which you've addressed, so I know if you're still working on things, or if I should review again. |
Yes sure, I will also re-request a review as soon as I finished walking through. |
@bicarlsen thanks for the review. I must admit, the initial PR state was just a copy-paste of Despite to this, I adjusted most of your suggestions. Unfinished threads are still left open. I think there is much more work to do on this, as I did not update the documentation yet to match the ones from the reference. Some ideas I had during my walk through the code:
|
@emirror-de, thanks for all the work :) 1For the 2In general I would prefer deviating from the JS API if it means we can be more Rusty. function myFunction(requiredArg, optionalArg) should go to fn my_function(required_arg)
fn my_function_with_options(required_arg, optional_arg) |
This PR introduces the initial support for
dialog
,path
andfs
plugins.This is not yet 100% complete and tested, but at least an initial implementation to build on.
Updates that have been done:
FsOptions::dir
toFsOptions::base_dir
#[serde(rename_all = "camelCase")]
toFsOptions
Tested functions: