aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2019-08-07 22:08:43 +0100
committerHarry Jeffery <harry@exec64.co.uk>2019-08-07 22:08:43 +0100
commit6d43f274030ffc6f828e699eb8542ddab50d8d88 (patch)
tree839ecba6b186e6a220abbf65c2e62e911b934ae5 /src
parent4d90834f887478754948b7bc5febc155716d9313 (diff)
downloadimv-6d43f274030ffc6f828e699eb8542ddab50d8d88.tar.gz
navigator: Don't pickup child directories when non-recursive
Diffstat (limited to 'src')
-rw-r--r--src/navigator.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/navigator.c b/src/navigator.c
index a927be4..63db338 100644
--- a/src/navigator.c
+++ b/src/navigator.c
@@ -83,11 +83,14 @@ int imv_navigator_add(struct imv_navigator *nav, const char *path,
continue;
}
snprintf(path_buf, sizeof path_buf, "%s/%s", path, dir->d_name);
- if (recursive) {
+ struct stat new_path_info;
+ stat(path_buf, &new_path_info);
+ int is_dir = S_ISDIR(new_path_info.st_mode);
+ if (is_dir && recursive) {
if (imv_navigator_add(nav, path_buf, recursive) != 0) {
return 1;
}
- } else {
+ } else if (!is_dir) {
if (add_item(nav, path_buf) != 0) {
return 1;
}