Skip to content

Commit

Permalink
Junction
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jul 24, 2024
1 parent 588ad1b commit 149fb26
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/uv-cache/src/removal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ impl Removal {

// Remove the file.
self.total_bytes += metadata.len();
remove_file(path)?;
if cfg!(windows) && metadata.is_symlink() {
// Remove the junction.
remove_dir(path)?;
} else {
remove_file(path)?;
}

return Ok(());
}
Expand All @@ -64,7 +69,7 @@ impl Removal {

let entry = entry?;
if cfg!(windows) && entry.file_type().is_symlink() {
// In this branch, we try to handle junction removal.
// Remove the junction.
self.num_files += 1;
remove_dir(entry.path())?;
} else if entry.file_type().is_dir() {
Expand Down

0 comments on commit 149fb26

Please sign in to comment.