aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands/typed.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/commands/typed.rs')
-rw-r--r--helix-term/src/commands/typed.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 94cc33f0..dfc71dfd 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -1093,14 +1093,11 @@ fn change_current_directory(
.as_ref(),
);
- if let Err(e) = std::env::set_current_dir(dir) {
- bail!("Couldn't change the current working directory: {}", e);
- }
+ helix_loader::set_current_working_dir(dir)?;
- let cwd = std::env::current_dir().context("Couldn't get the new working directory")?;
cx.editor.set_status(format!(
"Current working directory is now {}",
- cwd.display()
+ helix_loader::current_working_dir().display()
));
Ok(())
}
@@ -1114,9 +1111,14 @@ fn show_current_directory(
return Ok(());
}
- let cwd = std::env::current_dir().context("Couldn't get the new working directory")?;
- cx.editor
- .set_status(format!("Current working directory is {}", cwd.display()));
+ let cwd = helix_loader::current_working_dir();
+ let message = format!("Current working directory is {}", cwd.display());
+
+ if cwd.exists() {
+ cx.editor.set_status(message);
+ } else {
+ cx.editor.set_error(format!("{} (deleted)", message));
+ }
Ok(())
}