Skip to content
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

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

EvysGarden
Copy link

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.

Copy link
Owner

@Byron Byron left a 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.

@Byron Byron marked this pull request as draft October 18, 2023 05:58
@EvysGarden
Copy link
Author

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.

@Byron
Copy link
Owner

Byron commented Oct 18, 2023

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 example would work as well.

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);
}

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants