diff --git a/.changes/fix-fs-build.md b/.changes/fix-fs-build.md new file mode 100644 index 00000000..023e974c --- /dev/null +++ b/.changes/fix-fs-build.md @@ -0,0 +1,6 @@ +--- +fs: patch +fs-js: patch +--- + +Fixed docs.rs build. diff --git a/plugins/fs/build.rs b/plugins/fs/build.rs index 3909b1c0..9c34586e 100644 --- a/plugins/fs/build.rs +++ b/plugins/fs/build.rs @@ -208,11 +208,18 @@ permissions = [ } } - tauri_plugin::Builder::new(&COMMANDS.iter().map(|c| c.0).collect::>()) - .global_api_script_path("./api-iife.js") - .global_scope_schema(schemars::schema_for!(FsScopeEntry)) - .android_path("android") - .build(); + tauri_plugin::Builder::new( + &COMMANDS + .iter() + // FIXME: https://docs.rs/crate/tauri-plugin-fs/2.1.0/builds/1571296 + .filter(|c| c.1.is_empty()) + .map(|c| c.0) + .collect::>(), + ) + .global_api_script_path("./api-iife.js") + .global_scope_schema(schemars::schema_for!(FsScopeEntry)) + .android_path("android") + .build(); // workaround to include nested permissions as `tauri_plugin` doesn't support it let permissions_dir = autogenerated.join("commands"); @@ -234,9 +241,11 @@ permissions = [ .iter_mut() .filter(|p| p.identifier.starts_with("allow")) { - p.commands - .allow - .extend(nested_commands.iter().map(|s| s.to_string())); + for c in nested_commands.iter().map(|s| s.to_string()) { + if !p.commands.allow.contains(&c) { + p.commands.allow.push(c); + } + } } let out = toml::to_string_pretty(&permission_file) @@ -248,7 +257,10 @@ permissions = [ {out}"# ); - std::fs::write(permission_path, out) - .unwrap_or_else(|_| panic!("failed to write {command}.toml")); + + if content != out { + std::fs::write(permission_path, out) + .unwrap_or_else(|_| panic!("failed to write {command}.toml")); + } } }