Change back retro_dirent_is_dir to hopefully avoid sshfs issues

- more rigorous testing should be applied before changing these
functions
This commit is contained in:
twinaphex 2016-05-11 18:54:22 +02:00
parent fc56f6ebdb
commit 377f09f12a
3 changed files with 3 additions and 6 deletions

View File

@ -158,7 +158,7 @@ const char *retro_dirent_get_name(struct RDIR *rdir)
* Returns: true if directory listing entry is * Returns: true if directory listing entry is
* a directory, false if not. * a directory, false if not.
*/ */
bool retro_dirent_is_dir(struct RDIR *rdir) bool retro_dirent_is_dir(struct RDIR *rdir, const char *path)
{ {
#if defined(_WIN32) #if defined(_WIN32)
const WIN32_FIND_DATA *entry = (const WIN32_FIND_DATA*)&rdir->entry; const WIN32_FIND_DATA *entry = (const WIN32_FIND_DATA*)&rdir->entry;
@ -174,18 +174,15 @@ bool retro_dirent_is_dir(struct RDIR *rdir)
CellFsDirent *entry = (CellFsDirent*)&rdir->entry; CellFsDirent *entry = (CellFsDirent*)&rdir->entry;
return (entry->d_type == CELL_FS_TYPE_DIRECTORY); return (entry->d_type == CELL_FS_TYPE_DIRECTORY);
#elif defined(DT_DIR) #elif defined(DT_DIR)
const char *path = NULL;
const struct dirent *entry = (const struct dirent*)rdir->entry; const struct dirent *entry = (const struct dirent*)rdir->entry;
if (entry->d_type == DT_DIR) if (entry->d_type == DT_DIR)
return true; return true;
/* This can happen on certain file systems. */ /* This can happen on certain file systems. */
path = retro_dirent_get_name(rdir);
if (entry->d_type == DT_UNKNOWN || entry->d_type == DT_LNK) if (entry->d_type == DT_UNKNOWN || entry->d_type == DT_LNK)
return path_is_directory(path); return path_is_directory(path);
return false; return false;
#else #else
/* dirent struct doesn't have d_type, do it the slow way ... */ /* dirent struct doesn't have d_type, do it the slow way ... */
const char *path = retro_dirent_get_name(rdir);
return path_is_directory(path); return path_is_directory(path);
#endif #endif
} }

View File

@ -49,7 +49,7 @@ const char *retro_dirent_get_name(struct RDIR *rdir);
* Returns: true if directory listing entry is * Returns: true if directory listing entry is
* a directory, false if not. * a directory, false if not.
*/ */
bool retro_dirent_is_dir(struct RDIR *rdir); bool retro_dirent_is_dir(struct RDIR *rdir, const char *path);
void retro_closedir(struct RDIR *rdir); void retro_closedir(struct RDIR *rdir);

View File

@ -188,7 +188,7 @@ struct string_list *dir_list_new(const char *dir,
const char *file_ext = path_get_extension(name); const char *file_ext = path_get_extension(name);
fill_pathname_join(file_path, dir, name, sizeof(file_path)); fill_pathname_join(file_path, dir, name, sizeof(file_path));
is_dir = retro_dirent_is_dir(entry); is_dir = retro_dirent_is_dir(entry, file_path);
ret = parse_dir_entry(name, file_path, is_dir, ret = parse_dir_entry(name, file_path, is_dir,
include_dirs, include_compressed, list, ext_list, file_ext); include_dirs, include_compressed, list, ext_list, file_ext);