fix: fix types not being re-exported

Code responsible for removing the file at the
destination has been removed which broke the
re-exporting of types. This commit reverts
that change, but also silences Windows errors
when removing the file.
This commit is contained in:
daimond113 2025-02-08 00:48:42 +01:00
parent 4d39ddae04
commit a4927bf4be
No known key found for this signature in database
GPG key ID: 640DC95EC1190354
2 changed files with 11 additions and 5 deletions

View file

@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Fixed ### Fixed
- Fix `self-upgrade` using the wrong path when doing a fresh download by @daimond113 - Fix `self-upgrade` using the wrong path when doing a fresh download by @daimond113
- Fix types not being re-exported by @daimond113
## [0.6.0-rc.2] - 2025-02-07 ## [0.6.0-rc.2] - 2025-02-07
### Fixed ### Fixed

View file

@ -34,11 +34,16 @@ async fn create_and_canonicalize<P: AsRef<Path>>(path: P) -> std::io::Result<Pat
async fn write_cas(destination: PathBuf, cas_dir: &Path, contents: &str) -> std::io::Result<()> { async fn write_cas(destination: PathBuf, cas_dir: &Path, contents: &str) -> std::io::Result<()> {
let hash = store_in_cas(cas_dir, contents.as_bytes()).await?; let hash = store_in_cas(cas_dir, contents.as_bytes()).await?;
match fs::hard_link(cas_path(&hash, cas_dir), destination).await { match fs::remove_file(&destination).await {
Ok(_) => Ok(()), Ok(_) => {}
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => Ok(()), Err(e) if e.kind() == std::io::ErrorKind::NotFound => {}
Err(e) => Err(e), // TODO: investigate why this happens and whether we can avoid it without ignoring all PermissionDenied errors
} #[cfg(windows)]
Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => {}
Err(e) => return Err(e),
};
fs::hard_link(cas_path(&hash, cas_dir), destination).await
} }
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]