fix: correctly copy workspace packages

This commit is contained in:
daimond113 2024-11-20 20:03:16 +01:00
parent 745828f926
commit ac73a15c9d
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
2 changed files with 12 additions and 3 deletions

View file

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Add back mistakenly removed updates check caching by @daimond113 - Add back mistakenly removed updates check caching by @daimond113
- Set download error source to inner error to propagate the error by @daimond113 - Set download error source to inner error to propagate the error by @daimond113
- Correctly copy workspace packages by @daimond113
## [0.5.0-rc.10] - 2024-11-16 ## [0.5.0-rc.10] - 2024-11-16
### Fixed ### Fixed

View file

@ -172,7 +172,7 @@ impl PackageFS {
let mut read_dirs = VecDeque::from([fs::read_dir(src.to_path_buf())]); let mut read_dirs = VecDeque::from([fs::read_dir(src.to_path_buf())]);
while let Some(read_dir) = read_dirs.pop_front() { while let Some(read_dir) = read_dirs.pop_front() {
let mut read_dir = read_dir.await?; let mut read_dir = read_dir.await?;
while let Some(entry) = read_dir.next_entry().await? { 'entry: while let Some(entry) = read_dir.next_entry().await? {
let relative_path = let relative_path =
RelativePathBuf::from_path(entry.path().strip_prefix(src).unwrap()) RelativePathBuf::from_path(entry.path().strip_prefix(src).unwrap())
.unwrap(); .unwrap();
@ -185,10 +185,12 @@ impl PackageFS {
for other_target in TargetKind::VARIANTS { for other_target in TargetKind::VARIANTS {
if target.packages_folder(other_target) == file_name { if target.packages_folder(other_target) == file_name {
continue; continue 'entry;
} }
} }
fs::create_dir_all(relative_path.to_path(destination.as_ref())).await?;
read_dirs.push_back(fs::read_dir(entry.path())); read_dirs.push_back(fs::read_dir(entry.path()));
continue; continue;
} }
@ -197,7 +199,13 @@ impl PackageFS {
continue; continue;
} }
fs::copy(entry.path(), relative_path.to_path(destination.as_ref())).await?; let path = relative_path.to_path(destination.as_ref());
if let Some(parent) = path.parent() {
fs::create_dir_all(parent).await?;
}
fs::copy(entry.path(), path).await?;
} }
} }
} }