diff --git a/crates/gpui/src/platform/windows/platform.rs b/crates/gpui/src/platform/windows/platform.rs index 0b0c6ad3c2897f474e06ee38536d5435f47e7a98..5333682fad4f18b018345fa0cb05546e3dba885b 100644 --- a/crates/gpui/src/platform/windows/platform.rs +++ b/crates/gpui/src/platform/windows/platform.rs @@ -435,7 +435,7 @@ impl Platform for WindowsPlatform { if path.is_empty() { return; } - open_target(path); + open_target_in_explorer(path); }) .detach(); } @@ -734,6 +734,25 @@ fn open_target(target: &str) { } } +fn open_target_in_explorer(target: &str) { + unsafe { + let ret = ShellExecuteW( + None, + windows::core::w!("open"), + windows::core::w!("explorer.exe"), + &HSTRING::from(format!("/select,{}", target).as_str()), + None, + SW_SHOWDEFAULT, + ); + if ret.0 <= 32 { + log::error!( + "Unable to open target in explorer: {}", + std::io::Error::last_os_error() + ); + } + } +} + unsafe fn show_savefile_dialog(directory: PathBuf) -> Result { let dialog: IFileSaveDialog = CoCreateInstance(&FileSaveDialog, None, CLSCTX_ALL)?; let bind_context = CreateBindCtx(0)?;