Skip to main content

pacenotes_installer\ui/
explorer.rs

1/// Shows `path` in Explorer with it selected, since what the user needs is to
2/// find the file, usually to attach it, and a `.log` may open with anything.
3pub fn reveal_in_explorer(path: &std::path::Path) {
4    let verb = crate::i18n::to_wide("open");
5    let target = crate::i18n::to_wide("explorer.exe");
6    let arguments = crate::i18n::to_wide(&format!("/select,\"{}\"", path.display()));
7    unsafe {
8        windows_sys::Win32::UI::Shell::ShellExecuteW(
9            core::ptr::null_mut(),
10            verb.as_ptr(),
11            target.as_ptr(),
12            arguments.as_ptr(),
13            core::ptr::null(),
14            windows_sys::Win32::UI::WindowsAndMessaging::SW_SHOWNORMAL,
15        );
16    }
17}