-
Notifications
You must be signed in to change notification settings - Fork 29
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 metadata function #95
Conversation
I've also added a stub to allow unix platforms that aren't yet supported by get_mount_points (like Redox) to at least work with the home trash. I can do that in a different PR if desired. |
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 all the work you put in to make this happen!
Particularly Windows looks like it wasn't easy to get there (and it feels like one has to read a book to do anything on this platform).
The biggest change request is probably around how metadata is represented, and I hope it makes sense to you as well.
src/windows.rs
Outdated
pub fn metadata(item: &TrashItem) -> Result<TrashItemMetadata, Error> { | ||
ensure_com_initialized(); | ||
unsafe { | ||
let id_as_wide: Vec<u16> = item.id.encode_wide().chain(std::iter::once(0)).collect(); |
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.
I don't want to burden you, but I'd love it if there was a to_wide_path(&OsStr) -> Vec<u16>
or something that replaces this code here and in 5 other places in this file.
Thanks for the review! I will work on addressing these tomorrow |
@Byron I addressed most of your comments, please take a look. |
Thanks a lot for addressing most of the changes and for contributing, it's appreciated. I did the rest of the changes and will merge in a moment. |
Resolves #94, adds a metadata function to get the type of the item (file or folder) and the size (in bytes for files or entries for folders). This is implemented for Freedesktop platforms and Windows