-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
draft: Check trash path #88
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for contributing, having such a check seems very reasonable.
Why would MacOS not have the example? The commit message didn't tell.
Further it seems that this is only implemented for FreeDesktop, and think this should be implement for all platforms. Once a test is available, CI can be used to validate the implementation as it's fine to try to delete the trash folder on CI for sure.
i added freedesktop support because i'm on a linux device and don't have a macos environment to test in. I'll look into it but i can't properly test it. |
Once there is an integration test that tries to delete the trash directory, CI will test it for you. By extension, the And for this feature to go forward, a test will be needed. Thanks for your understanding. |
if topdir == home_topdir { | ||
if path.starts_with(home_trash.as_path()) { | ||
return Err(Error::TargetedTrash); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should no action be performed in this case?
Issue
The current implementation allows the removal of a trash folder with trash-rs
Fix
This seems rather weird so i added a check for it.
Note
I also added an example that simply passes all args to delete_all. I made it anyway so might as well push it.
This is marked as a draft because I'm not sure whether my code meets your quality.