Skip to content

Commit

Permalink
fix(fs): Temp workaround for docs.rs build error
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianLars committed Dec 9, 2024
1 parent 61072a3 commit 60d0842
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions plugins/fs/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,18 @@ permissions = [
}
}

tauri_plugin::Builder::new(&COMMANDS.iter().map(|c| c.0).collect::<Vec<_>>())
.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::<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
let permissions_dir = autogenerated.join("commands");
Expand All @@ -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)
Expand All @@ -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"));
}
}
}

0 comments on commit 60d0842

Please sign in to comment.