Skip to content

Commit 0862570

Browse files
the-mikedavispaholg
authored andcommitted
Add directory name to :cd errors
For example `:cd README.md` would say "Not a directory" but would not print the directory name. Now the error message includes some context about the operation and requested directory.
1 parent 03e0463 commit 0862570

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

helix-term/src/commands/typed.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,12 @@ fn change_current_directory(
11051105
None => Cow::Owned(home_dir()?),
11061106
};
11071107

1108-
cx.editor.set_cwd(&dir)?;
1108+
cx.editor.set_cwd(&dir).map_err(|err| {
1109+
anyhow!(
1110+
"Could not change working directory to '{}': {err}",
1111+
dir.display()
1112+
)
1113+
})?;
11091114

11101115
cx.editor.set_status(format!(
11111116
"Current working directory is now {}",

0 commit comments

Comments
 (0)