fix: fix self-install cross-device move

This commit is contained in:
daimond113 2024-11-16 18:36:45 +01:00
parent 00b470b173
commit 5a82f8616f
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
2 changed files with 8 additions and 2 deletions

View file

@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Fix `self-install` doing a cross-device move by @daimond113
## [0.5.0-rc.9] - 2024-11-16
### Fixed
- Correctly link Wally server packages by @daimond113

View file

@ -287,11 +287,13 @@ pub async fn update_bin_exe(downloaded_file: &Path) -> anyhow::Result<()> {
));
let mut downloaded_file = downloaded_file.to_path_buf();
if cfg!(target_os = "linux") && bin_exe_path.exists() {
let exists = bin_exe_path.exists();
if cfg!(target_os = "linux") && exists {
fs::remove_file(&bin_exe_path)
.await
.context("failed to remove existing executable")?;
} else {
} else if exists {
let tempfile = tempfile::Builder::new()
.make(|_| Ok(()))
.context("failed to create temporary file")?;