diff options
Diffstat (limited to 'src/app/tab.rs')
-rw-r--r-- | src/app/tab.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/app/tab.rs b/src/app/tab.rs index e8c1d12..6bccf28 100644 --- a/src/app/tab.rs +++ b/src/app/tab.rs @@ -435,6 +435,13 @@ impl Tab { /// Reset the window. /// Add the last path to the history of visited paths. pub fn cd(&mut self, path: &path::Path) -> Result<()> { + match std::env::set_current_dir(path) { + Ok(()) => (), + Err(error) => { + crate::log_info!("can't reach {path}. Error {error}", path = path.display()); + return Ok(()); + } + } self.history.push( &self.directory.path, &self.directory.selected().context("")?.path, @@ -446,7 +453,6 @@ impl Tab { } self.window.reset(self.directory.content.len()); crate::log_info!("done cd: {path}", path = path.display()); - let _ = std::env::set_current_dir(path); Ok(()) } |