fix(fs): Temp workaround for docs.rs build error (#2171)

* test

* test

* fix(fs): Temp workaround for docs.rs build error

* change
pull/2172/head
Fabian-Lars 6 months ago committed by GitHub
parent 6b1a6d62f0
commit 77b855074a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,6 @@
---
fs: patch
fs-js: patch
---
Fixed docs.rs build.

@ -208,11 +208,18 @@ permissions = [
} }
} }
tauri_plugin::Builder::new(&COMMANDS.iter().map(|c| c.0).collect::<Vec<_>>()) tauri_plugin::Builder::new(
.global_api_script_path("./api-iife.js") &COMMANDS
.global_scope_schema(schemars::schema_for!(FsScopeEntry)) .iter()
.android_path("android") // FIXME: https://docs.rs/crate/tauri-plugin-fs/2.1.0/builds/1571296
.build(); .filter(|c| c.1.is_empty())
.map(|c| c.0)
.collect::<Vec<_>>(),
)
.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 // workaround to include nested permissions as `tauri_plugin` doesn't support it
let permissions_dir = autogenerated.join("commands"); let permissions_dir = autogenerated.join("commands");
@ -234,9 +241,11 @@ permissions = [
.iter_mut() .iter_mut()
.filter(|p| p.identifier.starts_with("allow")) .filter(|p| p.identifier.starts_with("allow"))
{ {
p.commands for c in nested_commands.iter().map(|s| s.to_string()) {
.allow if !p.commands.allow.contains(&c) {
.extend(nested_commands.iter().map(|s| s.to_string())); p.commands.allow.push(c);
}
}
} }
let out = toml::to_string_pretty(&permission_file) let out = toml::to_string_pretty(&permission_file)
@ -248,7 +257,10 @@ permissions = [
{out}"# {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"));
}
} }
} }

Loading…
Cancel
Save