Unnamed repository; edit this file 'description' to name the repository.
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.
Michael Davis 2025-01-12
parent b05971f · commit 0f2ce30
-rw-r--r--helix-term/src/commands/typed.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 078bb800..4a2546d7 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -1105,7 +1105,12 @@ fn change_current_directory(
None => Cow::Owned(home_dir()?),
};
- cx.editor.set_cwd(&dir)?;
+ cx.editor.set_cwd(&dir).map_err(|err| {
+ anyhow!(
+ "Could not change working directory to '{}': {err}",
+ dir.display()
+ )
+ })?;
cx.editor.set_status(format!(
"Current working directory is now {}",