From 1afa9df6d53ad252ff6b35b395d877b7a15e4b58 Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Fri, 31 Oct 2025 02:19:35 +0100 Subject: [PATCH] fix(tauri-utils): Use write_if_changed more (#13621) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace `fs::write` with `write_if_changed` in two places. This can prevent unnecessary rebuilds. (I didn’t encounter any, but this should be ok nonetheless.) --- crates/tauri-utils/src/acl/build.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/tauri-utils/src/acl/build.rs b/crates/tauri-utils/src/acl/build.rs index d43afc281..44867f3f9 100644 --- a/crates/tauri-utils/src/acl/build.rs +++ b/crates/tauri-utils/src/acl/build.rs @@ -91,7 +91,8 @@ pub fn define_permissions bool>( let pkg_name_valid_path = pkg_name.replace(':', "-"); let permission_files_path = out_dir.join(format!("{pkg_name_valid_path}-permission-files")); let permission_files_json = serde_json::to_string(&permission_files)?; - fs::write(&permission_files_path, permission_files_json) + + write_if_changed(&permission_files_path, permission_files_json) .map_err(|e| Error::WriteFile(e, permission_files_path.clone()))?; if let Some(plugin_name) = pkg_name.strip_prefix("tauri:") { @@ -151,7 +152,8 @@ pub fn define_global_scope_schema( out_dir: &Path, ) -> Result<(), Error> { let path = out_dir.join("global-scope.json"); - fs::write(&path, serde_json::to_vec(&schema)?).map_err(|e| Error::WriteFile(e, path.clone()))?; + write_if_changed(&path, serde_json::to_vec(&schema)?) + .map_err(|e| Error::WriteFile(e, path.clone()))?; if let Some(plugin_name) = pkg_name.strip_prefix("tauri:") { println!(