-
Notifications
You must be signed in to change notification settings - Fork 310
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
add tauri-plugin-fs-pro #404
Conversation
I'm a bit confused why this plugin exists as-is tbh. fs-extra only existed in v1 because the core fs api was missing things. Your plugin however only supports v2 but all of the listed methods also exist in the official fs plugin (and shell/opener for i really don't want to talk bad about your work here of course, i just think that listed community plugins should have value over the official ones. |
|
I think for the dirSize thing we also would have accepted a PR, just as a seperate function instead of adding it to the metadata (so basically your point 2 but the other way around) I will leave this PR unmerged for a few more days to see if the rest of the team has any opinions |
Regarding the release of the opener plugin, it was really helpful to me! Also, I added As for the |
no worries :)
that's reason enough to merge this pr then :D |
🌹 |
I've roughly written it down for you to read first! #[tauri::command]
pub async fn size<R: Runtime>(
webview: Webview<R>,
global_scope: GlobalScope<Entry>,
command_scope: CommandScope<Entry>,
path: SafeFilePath,
options: Option<BaseOptions>,
) -> CommandResult<u64> {
let resolved_path = resolve_path(
&webview,
&global_scope,
&command_scope,
path,
options.as_ref().and_then(|o| o.base_dir),
)?;
let metadata = resolved_path.metadata()?;
if metadata.is_file() {
Ok(metadata.len())
} else {
let size = get_dir_size(resolved_path).map_err(|e| {
format!(
"failed to get size at path: {} with error: {e}",
path.display()
)
})?;
Ok(size)
}
}
fn get_dir_size(path: PathBuf) -> CommandResult<u64> {
let mut size = 0;
for entry in std::fs::read_dir(path)? {
let entry = entry?;
let metadata = entry.metadata()?;
if metadata.is_file() {
size += metadata.len();
} else if metadata.is_dir() {
size += get_dir_size(entry.path())?;
}
}
Ok(size)
} |
that looks fine at first glance |
I pr a prototype, you help me to optimize it again, thanks! |
tauri-apps/plugins-workspace#2095 thank you for your time.🌹 |
This is the link to the project: tauri-plugin-fs-pro
[Title](link) - Description.
![closed source]
badge after the(link)
but before the-
.![paid]
badge after the(link)
but before the-
.for Tauri
,a Tauri plugin
andSuper-Fast
.A
orAn
.backticks
when mentioning package names.Plugins/Integrations
Templates
Apps
Additional Context