diff --git a/crates/engine/src/script/files.rs b/crates/engine/src/script/files.rs index 10f89943ba..5b96191afc 100644 --- a/crates/engine/src/script/files.rs +++ b/crates/engine/src/script/files.rs @@ -2027,7 +2027,7 @@ fn xmp_write(host: &Host, a: &[Data]) -> Result { let name = target.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default(); let temp_name = |n: u32| target.with_file_name(format!(".{name}.{}.{n}.tmp", std::process::id())); let first = temp_name(0); - let temp_allowed = disk.target(&first.to_string_lossy(), false).is_ok_and(|t| t == first); + let temp_allowed = disk.target(&shown(&first), false).is_ok_and(|t| t == first); // A safe update writes only through a temporary file. if safely && !temp_allowed { return Ok(error(WRITE_FAILED)); @@ -2040,7 +2040,7 @@ fn xmp_write(host: &Host, a: &[Data]) -> Result { // The temporary file takes a name no file or link has, so only the sidecar is replaced; when // none of the names is free the sidecar is left as it is. // Each name is checked against the places the run may write before it is made. - let allowed = |t: &Path| disk.target(&t.to_string_lossy(), false).is_ok_and(|r| r == t); + let allowed = |t: &Path| disk.target(&shown(t), false).is_ok_and(|r| r == t); let new_file = |t: &Path| { let mut options = std::fs::OpenOptions::new(); options.write(true).create_new(true);