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

Include "trash folder" in API #25

Open
Torrencem opened this issue May 18, 2020 · 3 comments
Open

Include "trash folder" in API #25

Torrencem opened this issue May 18, 2020 · 3 comments
Labels
A-docs Area: affects documentation C-proposal Category: a proposal for something we might want to do, or maybe not; details still being worked out C-question Category: Not a bug, but someone asking for support postponed

Comments

@Torrencem
Copy link

Torrencem commented May 18, 2020

This is a migration of an issue in the old repository.

It would be useful to include a function which gets the path of a user "trash" folder. The problem on the old repository, to summarize, was how Windows didn't have a normal path to the recycle bin.

This is, as far as I can tell, not exactly right: It looks like Windows 7's recycle bin is stored in a hidden folder at "C:\$Recycle.Bin". This appears to be true in Windows 10 as well

Also potentially relevant, Windows appears to have subdirectories of "C:\$Recycle.Bin" for each user's SID, depending on who deleted a file.

So, just to summarize what could work, trash could return:
"$XDG_DATA_DIR/Trash" for Linux (on only some distros? more research is needed)
"$HOME/.Trash" for MacOS
and probably "C:\$Recycle.Bin" for Windows (or "C:\$Recycle.Bin\%SID%" where %SID% is the current user's SID)

@tesuji tesuji added C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement C-question Category: Not a bug, but someone asking for support E-help-wanted An issue where some help would be really appreciated. :) labels May 19, 2020
@tesuji
Copy link
Contributor

tesuji commented May 20, 2020

Could you tell me what use-cases that locating trash folder are needed?
I guess temporarily removing files to trash bins to recover later is one.

@tesuji
Copy link
Contributor

tesuji commented May 20, 2020

Researching a bit. I think trash bin usages should be in another crate.
The purpose of trash bin/can is to give users one last change to recover files
one deleted by mistakes.

Simply moving files to trash bin location is not enough. You will lost information
such as the original location of files, original filenames if you rename files when moving,
last date modified.

One should consult OS APIs on how to delete files temporarily.

Anyway, I don't think providing trash bin location is a good API decision.
I would write a bit about that in documentation of dirs and directories.


References:

@tesuji tesuji added A-docs Area: affects documentation C-proposal Category: a proposal for something we might want to do, or maybe not; details still being worked out and removed C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement E-help-wanted An issue where some help would be really appreciated. :) labels May 20, 2020
@Torrencem
Copy link
Author

Yeah, I guess since they're such special case folders, it's probably not a good addition, makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: affects documentation C-proposal Category: a proposal for something we might want to do, or maybe not; details still being worked out C-question Category: Not a bug, but someone asking for support postponed
Projects
None yet
Development

No branches or pull requests

3 participants