Open Torrencem opened 4 years ago
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.
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:
Yeah, I guess since they're such special case folders, it's probably not a good addition, makes sense
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)