Cargo clean removes target directory, even when it is a softlink #13670
Labels
C-bug
Category: bug
Command-clean
S-needs-info
Status: Needs more info, such as a reproduction or more background for a feature request.
Problem
Running
cargo clean
deletes the target directory, which is usually fine, because it is regenerated on the nextcargo build
.However, I used a symlink for my target directory because I want my code to be synced across devices, but not bloat it with the build artifacts.
cargo clean
simply removed the symlink.In my opinion, it should either give a warning or follow the symlink; not fail silently.
Steps
cargo build
cargo clean
The symlink is gone and on the next
cargo build
, it will be a regular directory instead.Possible Solution(s)
Always following symlinks might not be a good idea, so it should probably warn the user and abort. (To work proberly, that would require a new flag for
cargo clean
though)Notes
No response
Version
The text was updated successfully, but these errors were encountered: