mirror of
https://github.com/libretro/RetroArch
synced 2025-02-16 21:40:04 +00:00
Use path_is_directory from retro_dirent.c
This commit is contained in:
parent
4d8b3c4c48
commit
f581dce1f7
@ -35,6 +35,7 @@
|
||||
#endif
|
||||
|
||||
#include <boolean.h>
|
||||
#include <file/file_path.h>
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user