@@ -208,11 +208,18 @@ permissions = [
208
208
}
209
209
}
210
210
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 ( ) ;
216
223
217
224
// workaround to include nested permissions as `tauri_plugin` doesn't support it
218
225
let permissions_dir = autogenerated. join ( "commands" ) ;
@@ -234,9 +241,11 @@ permissions = [
234
241
. iter_mut ( )
235
242
. filter ( |p| p. identifier . starts_with ( "allow" ) )
236
243
{
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
+ }
240
249
}
241
250
242
251
let out = toml:: to_string_pretty ( & permission_file)
@@ -248,7 +257,10 @@ permissions = [
248
257
249
258
{out}"#
250
259
) ;
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
+ }
253
265
}
254
266
}
0 commit comments