diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 807f3c7f7..fa3a9439e 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -178,18 +178,18 @@ fn open(cx: &mut compositor::Context, args: &[Cow], event: PromptEvent) -> // Add each parent as a glob for filtering in the recursive walker parent_dirs_glob_set_builder.add(glob(parent)?); - if root.is_none() && parent.exists() { + if parent.exists() { // Found the first parent that exists - root = Some(parent.to_path_buf()); + root = Some(parent); break; } } + let root = root.context("invalid glob")?; let parent_dirs_glob_set = parent_dirs_glob_set_builder .build() .context("invalid glob")?; - let root = root.unwrap_or_else(current_working_dir); let Ok(dir_reader) = fs::read_dir(root) else { continue; };