mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-02-06 11:22:04 +00:00
fix(tauri-utils): Use write_if_changed more (#13621)
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.)
This commit is contained in:
parent
75a1fec705
commit
1afa9df6d5
@ -91,7 +91,8 @@ pub fn define_permissions<F: Fn(&Path) -> 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!(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user