-
Notifications
You must be signed in to change notification settings - Fork 11
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
Replace winapi dependency with windows #28
Conversation
opener/src/windows/reveal.rs
Outdated
let item_id_list = unsafe { ILCreateFromPathW(PCWSTR::from_raw(path.as_ptr())) }; | ||
unsafe { SHOpenFolderAndSelectItems(item_id_list, None, 0) }?; |
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.
This is one of those things I'm not sure of: do we still need to call ILFree
on item_id_list
after SHOpen...
?
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.
Yes, and it needs to be called even if SHOpenFolderAndSelectItems()
fails. The same goes for CoUninitialize()
.
Since normpath was [added][1], opener has depended on both winapi (directly) and windows-sys (transitively). This commit replaces usage of winapi with the windows crate so that it only depends on a single windows API crate. Additionally, the windows crate includes some functions that were manually linked in opener, so those manual links were able to be cleaned up. [1]: 3b48ee0
1f942b5
to
9fb4494
Compare
Friendly bump 🙂 Anything needed from me? |
I just pushed a commit fixing some style nits. However, I've just realized we're using the
The first option is simpler, but I believe there's some edge cases where |
I've switched over to |
Since normpath was added, opener has depended on both winapi (directly) and windows-sys (transitively).
This commit replaces usage of winapi with the windows crate so that it only depends on a single windows API crate. Additionally, the windows crate includes some functions that were manually linked in opener, so those manual links were able to be cleaned up.
I'm not very experienced with unsafe Rust 😅. Any feedback is appreciated!