From e252ab8f6154c570adac6af950af7c05644c1c0a Mon Sep 17 00:00:00 2001 From: Themaister Date: Mon, 18 Jun 2012 23:27:49 +0200 Subject: [PATCH] Optimize dir reading on Unix. --- file_path.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/file_path.c b/file_path.c index 7a88119db3..6219942a70 100644 --- a/file_path.c +++ b/file_path.c @@ -265,12 +265,13 @@ char **dir_list_new(const char *dir, const char *ext, bool include_dirs) { const char *name = entry->d_name; const char *file_ext = path_get_extension(name); + bool is_dir = entry->d_type == DT_DIR; - if (!include_dirs && path_is_directory(name)) + if (!include_dirs && is_dir) continue; #ifndef __CELLOS_LV2__ - if (!path_is_directory(name) && ext_list && !string_list_find_elem(ext_list, file_ext)) + if (!is_dir && ext_list && !string_list_find_elem(ext_list, file_ext)) continue; #endif