summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2016-11-06 19:02:14 -0500
committerAndrew Gallant <jamslam@gmail.com>2016-11-06 19:02:14 -0500
commitf24873c70b7f352f412359b15942754301424091 (patch)
treede4c13a2aae50f8a4b01b1aa3207b804536652ac /src
parent58126ffe157a1f1d4e6b802e1a99373a45a6a87d (diff)
Don't ever search directories.
Diffstat (limited to 'src')
-rw-r--r--src/main.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs
index 8b7a267d..b184a03d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -271,16 +271,15 @@ fn get_or_log_dir_entry(
eprintln!("{}", err);
}
}
- // A depth of 0 means the user gave the path explicitly, so we
- // should always try to search it.
- if dent.depth() == 0 {
- return Some(dent);
- }
let ft = match dent.file_type() {
None => return Some(dent), // entry is stdin
Some(ft) => ft,
};
- if ft.is_file() {
+ // A depth of 0 means the user gave the path explicitly, so we
+ // should always try to search it.
+ if dent.depth() == 0 && !ft.is_dir() {
+ Some(dent)
+ } else if ft.is_file() {
Some(dent)
} else {
None