Skip to content

Commit

Permalink
Fix opening new files (helix-editor#5278)
Browse files Browse the repository at this point in the history
Commit 1b89d3e 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.
  • Loading branch information
alois31 authored and hadronized committed Jan 4, 2023
1 parent ffe89ae commit 6435bfc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn open(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) ->
let (path, pos) = args::parse_file(arg);
// If the path is a directory, open a file picker on that directory and update the status
// message
if std::fs::canonicalize(&path)?.is_dir() {
if let Ok(true) = std::fs::canonicalize(&path).map(|p| p.is_dir()) {
let callback = async move {
let call: job::Callback = job::Callback::EditorCompositor(Box::new(
move |editor: &mut Editor, compositor: &mut Compositor| {
Expand Down

0 comments on commit 6435bfc

Please sign in to comment.