Fix self-install failure

reflink_or_copy now fails if the dest already exists

9e0b2cf427

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
Jiahao XU 2024-11-16 16:29:39 +11:00 committed by GitHub
parent bd8213e987
commit f32549a8a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -33,6 +33,7 @@ fn copy_to_tempfile(src: &Path, dst: &Path) -> io::Result<NamedTempFile> {
src.display(),
tempfile.path().display()
);
fs::remove_file(tempfile.path())?;
// src and dst is likely to be on the same filesystem.
// Uses reflink if the fs support it, or fallback to
// `fs::copy` if it doesn't support it or it is not on the