A root must be found if the path is not /

pull/9723/head
mo8it 7 months ago
parent 3d1716fe1a
commit fc7a1e7515

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

Loading…
Cancel
Save