on master help sign in
Fix opening new files (#5278)

Commit 1b89d3e5350f83b2ffb86a86326bd2714308ee53 introduced a regression where opening a new file would no longer work, because attempting to canonicalize its path would lead to a "No such file or directory" error. Fall back to opening a new file when encountering an error to fix this case.

commiteb4ec3271005e9de7960a4dd08a9efbb648cb89f authoralois31 <36605164+alois31@users.noreply.github.com> dateSat 24 Dec 2022, 14:50 (4 years ago) parentf0c6e6c
1 file changed+1−1
helix-term/src/commands/typed.rs+1−1
helix-term/src/commands/typed.rs+1−1
@@ -67,7 +67,7 @@ fn open(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) ->
6767 let (path, pos) = args::parse_file(arg);
6868 // If the path is a directory, open a file picker on that directory and update the status
6969 // message
70− if std::fs::canonicalize(&path)?.is_dir() {
70+ if let Ok(true) = std::fs::canonicalize(&path).map(|p| p.is_dir()) {
7171 let callback = async move {
7272 let call: job::Callback = job::Callback::EditorCompositor(Box::new(
7373 move |editor: &mut Editor, compositor: &mut Compositor| {