mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-08-16 19:30:27 +03:00
fix(build): avoid copying resource onto itself (#9710)
* fix(build): avoid copying resource onto itself closes #9666 * canonicalize once --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
parent
ccc3ea729d
commit
19b696b61c
6
.changes/build-resource-target-same-src.md
Normal file
6
.changes/build-resource-target-same-src.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri-build": "patch:bug"
|
||||
---
|
||||
|
||||
Avoid copying resources if the target path is the same as source.
|
||||
|
@ -93,10 +93,18 @@ fn copy_binaries(
|
||||
|
||||
/// Copies resources to a path.
|
||||
fn copy_resources(resources: ResourcePaths<'_>, path: &Path) -> Result<()> {
|
||||
let path = path.canonicalize()?;
|
||||
for resource in resources.iter() {
|
||||
let resource = resource?;
|
||||
|
||||
println!("cargo:rerun-if-changed={}", resource.path().display());
|
||||
copy_file(resource.path(), path.join(resource.target()))?;
|
||||
|
||||
// avoid copying the resource if target is the same as source
|
||||
let src = resource.path().canonicalize()?;
|
||||
let target = path.join(resource.target());
|
||||
if src != target {
|
||||
copy_file(src, target)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user