From 1eed0791f7779b7eee397518487c48a4232be293 Mon Sep 17 00:00:00 2001 From: pmqueiroz Date: Mon, 18 May 2026 19:35:28 -0300 Subject: [PATCH 1/2] fix(windows): start terminal in home dir when launched from install dir --- src/ui/app_state/update/mod.rs | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/ui/app_state/update/mod.rs b/src/ui/app_state/update/mod.rs index a7c3a7d..6ca46dc 100644 --- a/src/ui/app_state/update/mod.rs +++ b/src/ui/app_state/update/mod.rs @@ -52,10 +52,26 @@ impl Default for Nova { cols, rows, default_shell, - std::env::current_dir() - .ok() - .and_then(|p| p.into_os_string().into_string().ok()) - .unwrap_or_default(), + { + let cur = std::env::current_dir().ok(); + let exe_dir = std::env::current_exe() + .ok() + .and_then(|e| e.parent().map(|p| p.to_path_buf())); + let in_install_dir = cur + .as_ref() + .zip(exe_dir.as_ref()) + .map(|(c, e)| c == e) + .unwrap_or(false); + if in_install_dir { + dirs::home_dir() + .and_then(|p| p.into_os_string().into_string().ok()) + .unwrap_or_default() + } else { + cur + .and_then(|p| p.into_os_string().into_string().ok()) + .unwrap_or_default() + } + }, )], active_index: 0, next_tab_id: 1, From 407de197e489d27f3dbd685b30bfdfe67134c99d Mon Sep 17 00:00:00 2001 From: pmqueiroz Date: Mon, 18 May 2026 19:45:09 -0300 Subject: [PATCH 2/2] style: fmt --- src/ui/app_state/update/mod.rs | 46 +++++++++++++++------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/src/ui/app_state/update/mod.rs b/src/ui/app_state/update/mod.rs index 6ca46dc..81f40ce 100644 --- a/src/ui/app_state/update/mod.rs +++ b/src/ui/app_state/update/mod.rs @@ -47,32 +47,26 @@ impl Default for Nova { false, ); let mut nova = Self { - tabs: vec![Tab::new( - 0, - cols, - rows, - default_shell, - { - let cur = std::env::current_dir().ok(); - let exe_dir = std::env::current_exe() - .ok() - .and_then(|e| e.parent().map(|p| p.to_path_buf())); - let in_install_dir = cur - .as_ref() - .zip(exe_dir.as_ref()) - .map(|(c, e)| c == e) - .unwrap_or(false); - if in_install_dir { - dirs::home_dir() - .and_then(|p| p.into_os_string().into_string().ok()) - .unwrap_or_default() - } else { - cur - .and_then(|p| p.into_os_string().into_string().ok()) - .unwrap_or_default() - } - }, - )], + tabs: vec![Tab::new(0, cols, rows, default_shell, { + let cur = std::env::current_dir().ok(); + let exe_dir = std::env::current_exe() + .ok() + .and_then(|e| e.parent().map(|p| p.to_path_buf())); + let in_install_dir = cur + .as_ref() + .zip(exe_dir.as_ref()) + .map(|(c, e)| c == e) + .unwrap_or(false); + if in_install_dir { + dirs::home_dir() + .and_then(|p| p.into_os_string().into_string().ok()) + .unwrap_or_default() + } else { + cur + .and_then(|p| p.into_os_string().into_string().ok()) + .unwrap_or_default() + } + })], active_index: 0, next_tab_id: 1, window_id: None,