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.
This commit is contained in:
Michael Davis 2025-01-11 20:38:29 -05:00
parent b05971f178
commit 0f2ce303c5
No known key found for this signature in database

View file

@ -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 {}",