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

Add method to export trash path (issue #38) #67

Closed

Conversation

juanPabloMiceli
Copy link

Description

Up to now, there is no way of knowing where the files are going when removed. Of course you could use this specification, but doing that would require to duplicate the code for getting the trash directory on every user.

Possible solution

To fix this, public method thrash_path() has been added to the public API along with tests and documentation. This methods returns the same Trash directory that the crate uses for removing files.

Fixes issue #38.

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.

This probably needs some work to work on all platforms, and to not make the test depend on a particular platform.

let path = PathBuf::from(get_unique_name());
File::create(&path).unwrap();

delete(&path).unwrap();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe adjust delete so that it returns the path to the deleted file to make it possible to assert that it lives within the trash_path().

@Byron
Copy link
Owner

Byron commented Oct 18, 2023

Closing due to inactivity.

@Byron Byron closed this Oct 18, 2023
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.

2 participants