From f581dce1f7740526e3d9cee4fc23e022e8425c80 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 21 Sep 2015 23:20:33 +0200 Subject: [PATCH] Use path_is_directory from retro_dirent.c --- libretro-common/file/retro_dirent.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/libretro-common/file/retro_dirent.c b/libretro-common/file/retro_dirent.c index ac5773fed3..1df62e897e 100644 --- a/libretro-common/file/retro_dirent.c +++ b/libretro-common/file/retro_dirent.c @@ -35,6 +35,7 @@ #endif #include +#include struct RDIR { @@ -148,22 +149,13 @@ bool retro_dirent_is_dir(struct RDIR *rdir, const char *path) const struct dirent *entry = (const struct dirent*)rdir->entry; if (entry->d_type == DT_DIR) return true; - else if (entry->d_type == DT_UNKNOWN /* This can happen on certain file systems. */ - || entry->d_type == DT_LNK) - { - struct stat buf; - if (stat(path, &buf) < 0) - return false; - - return S_ISDIR(buf.st_mode); - } + /* This can happen on certain file systems. */ + if (entry->d_type == DT_UNKNOWN || entry->d_type == DT_LNK) + return path_is_directory(path); return false; -#else /* dirent struct doesn't have d_type, do it the slow way ... */ - struct stat buf; - if (stat(path, &buf) < 0) - return false; - - return S_ISDIR(buf.st_mode); +#else + /* dirent struct doesn't have d_type, do it the slow way ... */ + return path_is_directory(path); #endif }