sayanarijit / xplr

A hackable, minimal, fast TUI file explorer
https://xplr.dev
MIT License
4.08k stars 74 forks source link

Silently fail to 'enter' regular files #654

Closed duganchen closed 1 year ago

duganchen commented 1 year ago

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.

sayanarijit commented 1 year ago

I think we can use focused_node's built-in is_dir and symlink.is_dir, without needing a system call.

duganchen commented 1 year ago

I changed it to use focused_node().is_dir() and tested it. With both regular files and directories, and with symlinks of regular files and directories.

sayanarijit commented 1 year ago

Thanks.