Skip to content

Commit 507eeb7

Browse files
FabianLarsgezihuzi
authored andcommitted
fix(fs): Temp workaround for docs.rs build error (tauri-apps#2171)
* test * test * fix(fs): Temp workaround for docs.rs build error * change
1 parent a5c3e3a commit 507eeb7

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

.changes/fix-fs-build.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fs: patch
3+
fs-js: patch
4+
---
5+
6+
Fixed docs.rs build.

plugins/fs/build.rs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,18 @@ permissions = [
208208
}
209209
}
210210

211-
tauri_plugin::Builder::new(&COMMANDS.iter().map(|c| c.0).collect::<Vec<_>>())
212-
.global_api_script_path("./api-iife.js")
213-
.global_scope_schema(schemars::schema_for!(FsScopeEntry))
214-
.android_path("android")
215-
.build();
211+
tauri_plugin::Builder::new(
212+
&COMMANDS
213+
.iter()
214+
// FIXME: https://docs.rs/crate/tauri-plugin-fs/2.1.0/builds/1571296
215+
.filter(|c| c.1.is_empty())
216+
.map(|c| c.0)
217+
.collect::<Vec<_>>(),
218+
)
219+
.global_api_script_path("./api-iife.js")
220+
.global_scope_schema(schemars::schema_for!(FsScopeEntry))
221+
.android_path("android")
222+
.build();
216223

217224
// workaround to include nested permissions as `tauri_plugin` doesn't support it
218225
let permissions_dir = autogenerated.join("commands");
@@ -234,9 +241,11 @@ permissions = [
234241
.iter_mut()
235242
.filter(|p| p.identifier.starts_with("allow"))
236243
{
237-
p.commands
238-
.allow
239-
.extend(nested_commands.iter().map(|s| s.to_string()));
244+
for c in nested_commands.iter().map(|s| s.to_string()) {
245+
if !p.commands.allow.contains(&c) {
246+
p.commands.allow.push(c);
247+
}
248+
}
240249
}
241250

242251
let out = toml::to_string_pretty(&permission_file)
@@ -248,7 +257,10 @@ permissions = [
248257
249258
{out}"#
250259
);
251-
std::fs::write(permission_path, out)
252-
.unwrap_or_else(|_| panic!("failed to write {command}.toml"));
260+
261+
if content != out {
262+
std::fs::write(permission_path, out)
263+
.unwrap_or_else(|_| panic!("failed to write {command}.toml"));
264+
}
253265
}
254266
}

0 commit comments

Comments
 (0)