diff --git a/crates/gpui/src/platform/windows/platform.rs b/crates/gpui/src/platform/windows/platform.rs index 5219d8c8177f7c3dc76a7afab258e2c58a0ce6f8..361d8e114308323da8629fae93d257cc38147dba 100644 --- a/crates/gpui/src/platform/windows/platform.rs +++ b/crates/gpui/src/platform/windows/platform.rs @@ -951,17 +951,30 @@ fn file_save_dialog( ) -> Result> { let dialog: IFileSaveDialog = unsafe { CoCreateInstance(&FileSaveDialog, None, CLSCTX_ALL)? }; if !directory.to_string_lossy().is_empty() - && let Some(full_path) = directory.canonicalize().log_err() + && let Some(full_path) = directory + .canonicalize() + .context("failed to canonicalize directory") + .log_err() { let full_path = SanitizedPath::new(&full_path); let full_path_string = full_path.to_string(); let path_item: IShellItem = unsafe { SHCreateItemFromParsingName(&HSTRING::from(full_path_string), None)? }; - unsafe { dialog.SetFolder(&path_item).log_err() }; + unsafe { + dialog + .SetFolder(&path_item) + .context("failed to set dialog folder") + .log_err() + }; } if let Some(suggested_name) = suggested_name { - unsafe { dialog.SetFileName(&HSTRING::from(suggested_name)).log_err() }; + unsafe { + dialog + .SetFileName(&HSTRING::from(suggested_name)) + .context("failed to set file name") + .log_err() + }; } unsafe { diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rs index be038508880bb629c86b10b42d68907f1c60b0ae..e765fa1a22d54a645d094f0df3250f75c94387af 100644 --- a/crates/gpui/src/platform/windows/window.rs +++ b/crates/gpui/src/platform/windows/window.rs @@ -169,7 +169,9 @@ impl WindowsWindowState { length: std::mem::size_of::() as u32, ..Default::default() }; - GetWindowPlacement(self.hwnd, &mut placement).log_err(); + GetWindowPlacement(self.hwnd, &mut placement) + .context("failed to get window placement") + .log_err(); placement }; ( @@ -254,7 +256,9 @@ impl WindowsWindowInner { lock.fullscreen_restore_bounds = window_bounds; let style = WINDOW_STYLE(unsafe { get_window_long(this.hwnd, GWL_STYLE) } as _); let mut rc = RECT::default(); - unsafe { GetWindowRect(this.hwnd, &mut rc) }.log_err(); + unsafe { GetWindowRect(this.hwnd, &mut rc) } + .context("failed to get window rect") + .log_err(); let _ = lock.fullscreen.insert(StyleAndBounds { style, x: rc.left, @@ -301,15 +305,20 @@ impl WindowsWindowInner { }; match open_status.state { WindowOpenState::Maximized => unsafe { - SetWindowPlacement(self.hwnd, &open_status.placement)?; + SetWindowPlacement(self.hwnd, &open_status.placement) + .context("failed to set window placement")?; ShowWindowAsync(self.hwnd, SW_MAXIMIZE).ok()?; }, WindowOpenState::Fullscreen => { - unsafe { SetWindowPlacement(self.hwnd, &open_status.placement)? }; + unsafe { + SetWindowPlacement(self.hwnd, &open_status.placement) + .context("failed to set window placement")? + }; self.toggle_fullscreen(); } WindowOpenState::Windowed => unsafe { - SetWindowPlacement(self.hwnd, &open_status.placement)?; + SetWindowPlacement(self.hwnd, &open_status.placement) + .context("failed to set window placement")?; }, } Ok(())