Silently fail to 'enter' regular files (#654)

Silently fail to "Enter" regular files. Entering only makes sense for
directories.

This fixes
https://github.com/sayanarijit/xplr/issues/653#issue-1806818324

I don't know Rust at all, so I make no claims to the code quality. But I
have tested this change and it does work.
pull/656/head
Arijit Basu 10 months ago committed by GitHub
commit 567a6201a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1034,8 +1034,13 @@ impl App {
}
fn enter(self) -> Result<Self> {
if let Some(path) = self.focused_node().map(|n| n.absolute_path.clone()) {
self.change_directory(&path, true)
if let Some(node) = self.focused_node() {
if node.is_dir || node.symlink.as_ref().map(|s| s.is_dir).unwrap_or(false) {
let path = node.absolute_path.clone();
self.change_directory(&path, true)
} else {
Ok(self)
}
} else {
Ok(self)
}

Loading…
Cancel
Save