mirror of
https://github.com/libretro/RetroArch
synced 2025-04-02 07:20:34 +00:00
Merge pull request #2078 from CautiousAlbino/hang-fix2
Retry implementation of include_compressed to dir_list_new.
This commit is contained in:
commit
a2fc762bfc
@ -242,7 +242,7 @@ rarch_dsp_filter_t *rarch_dsp_filter_new(
|
|||||||
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
||||||
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
||||||
|
|
||||||
plugs = dir_list_new(basedir, EXT_EXECUTABLES, false);
|
plugs = dir_list_new(basedir, EXT_EXECUTABLES, false, false);
|
||||||
if (!plugs)
|
if (!plugs)
|
||||||
goto error;
|
goto error;
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,7 +25,7 @@ struct string_list *dir_list_new_special(const char *input_dir, enum dir_list_ty
|
|||||||
const char *exts = NULL;
|
const char *exts = NULL;
|
||||||
bool include_dirs = false;
|
bool include_dirs = false;
|
||||||
|
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
(void)input_dir;
|
(void)input_dir;
|
||||||
@ -58,5 +58,5 @@ struct string_list *dir_list_new_special(const char *input_dir, enum dir_list_ty
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dir_list_new(dir, exts, include_dirs);
|
return dir_list_new(dir, exts, include_dirs, false);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ static void find_first_libretro_core(char *first_file,
|
|||||||
RARCH_LOG("Searching for valid libretro implementation in: \"%s\".\n",
|
RARCH_LOG("Searching for valid libretro implementation in: \"%s\".\n",
|
||||||
dir);
|
dir);
|
||||||
|
|
||||||
list = dir_list_new(dir, ext, false);
|
list = dir_list_new(dir, ext, false, false);
|
||||||
if (!list)
|
if (!list)
|
||||||
{
|
{
|
||||||
RARCH_ERR("Couldn't read directory. Cannot infer default libretro core.\n");
|
RARCH_ERR("Couldn't read directory. Cannot infer default libretro core.\n");
|
||||||
|
@ -444,7 +444,7 @@ static bool gfx_ctx_drm_egl_init(void *data)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
drm->g_drm_fd = -1;
|
drm->g_drm_fd = -1;
|
||||||
gpu_descriptors = dir_list_new("/dev/dri", NULL, false);
|
gpu_descriptors = dir_list_new("/dev/dri", NULL, false, false);
|
||||||
|
|
||||||
nextgpu:
|
nextgpu:
|
||||||
free_drm_resources(drm);
|
free_drm_resources(drm);
|
||||||
|
@ -396,7 +396,7 @@ rarch_softfilter_t *rarch_softfilter_new(const char *filter_config,
|
|||||||
#if defined(HAVE_DYLIB)
|
#if defined(HAVE_DYLIB)
|
||||||
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
||||||
|
|
||||||
plugs = dir_list_new(basedir, EXT_EXECUTABLES, false);
|
plugs = dir_list_new(basedir, EXT_EXECUTABLES, false, false);
|
||||||
if (!plugs)
|
if (!plugs)
|
||||||
{
|
{
|
||||||
RARCH_ERR("[SoftFilter]: Could not build up string list...\n");
|
RARCH_ERR("[SoftFilter]: Could not build up string list...\n");
|
||||||
|
@ -199,10 +199,10 @@ static bool input_autoconfigure_joypad_from_conf_dir(
|
|||||||
sizeof(path));
|
sizeof(path));
|
||||||
|
|
||||||
if (settings)
|
if (settings)
|
||||||
list = dir_list_new(path, "cfg", false);
|
list = dir_list_new(path, "cfg", false, false);
|
||||||
|
|
||||||
if (!list || !list->size)
|
if (!list || !list->size)
|
||||||
list = dir_list_new(settings->input.autoconfig_dir, "cfg", false);
|
list = dir_list_new(settings->input.autoconfig_dir, "cfg", false, false);
|
||||||
|
|
||||||
if(!list)
|
if(!list)
|
||||||
return false;
|
return false;
|
||||||
|
@ -132,13 +132,14 @@ static bool dirent_is_directory(const char *path,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* parse_dir_entry:
|
* parse_dir_entry:
|
||||||
* @name : name of the directory listing entry.
|
* @name : name of the directory listing entry.
|
||||||
* @file_path : file path of the directory listing entry.
|
* @file_path : file path of the directory listing entry.
|
||||||
* @is_dir : is the directory listing a directory?
|
* @is_dir : is the directory listing a directory?
|
||||||
* @include_dirs : include directories as part of the finished directory listing?
|
* @include_dirs : include directories as part of the finished directory listing?
|
||||||
* @list : pointer to directory listing.
|
* @include_compressed : Include compressed files, even if not part of ext_list.
|
||||||
* @ext_list : pointer to allowed file extensions listing.
|
* @list : pointer to directory listing.
|
||||||
* @file_ext : file extension of the directory listing entry.
|
* @ext_list : pointer to allowed file extensions listing.
|
||||||
|
* @file_ext : file extension of the directory listing entry.
|
||||||
*
|
*
|
||||||
* Parses a directory listing.
|
* Parses a directory listing.
|
||||||
*
|
*
|
||||||
@ -146,7 +147,7 @@ static bool dirent_is_directory(const char *path,
|
|||||||
* continue to the next entry in the directory listing.
|
* continue to the next entry in the directory listing.
|
||||||
**/
|
**/
|
||||||
static int parse_dir_entry(const char *name, char *file_path,
|
static int parse_dir_entry(const char *name, char *file_path,
|
||||||
bool is_dir, bool include_dirs,
|
bool is_dir, bool include_dirs, bool include_compressed,
|
||||||
struct string_list *list, struct string_list *ext_list,
|
struct string_list *list, struct string_list *ext_list,
|
||||||
const char *file_ext)
|
const char *file_ext)
|
||||||
{
|
{
|
||||||
@ -169,7 +170,9 @@ static int parse_dir_entry(const char *name, char *file_path,
|
|||||||
if (!strcmp(name, ".") || !strcmp(name, ".."))
|
if (!strcmp(name, ".") || !strcmp(name, ".."))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (!is_compressed_file && !is_dir && ext_list && !supported_by_core)
|
if (!is_dir && ext_list &&
|
||||||
|
((!is_compressed_file && !supported_by_core) ||
|
||||||
|
(!supported_by_core && !include_compressed)))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (is_dir)
|
if (is_dir)
|
||||||
@ -195,9 +198,10 @@ static int parse_dir_entry(const char *name, char *file_path,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* dir_list_new:
|
* dir_list_new:
|
||||||
* @dir : directory path.
|
* @dir : directory path.
|
||||||
* @ext : allowed extensions of file directory entries to include.
|
* @ext : allowed extensions of file directory entries to include.
|
||||||
* @include_dirs : include directories as part of the finished directory listing?
|
* @include_dirs : include directories as part of the finished directory listing?
|
||||||
|
* @include_compressed : Only include files which match ext. Do not try to match compressed files, etc.
|
||||||
*
|
*
|
||||||
* Create a directory listing.
|
* Create a directory listing.
|
||||||
*
|
*
|
||||||
@ -205,7 +209,7 @@ static int parse_dir_entry(const char *name, char *file_path,
|
|||||||
* NULL in case of error. Has to be freed manually.
|
* NULL in case of error. Has to be freed manually.
|
||||||
**/
|
**/
|
||||||
struct string_list *dir_list_new(const char *dir,
|
struct string_list *dir_list_new(const char *dir,
|
||||||
const char *ext, bool include_dirs)
|
const char *ext, bool include_dirs, bool include_compressed)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
WIN32_FIND_DATA ffd;
|
WIN32_FIND_DATA ffd;
|
||||||
@ -247,14 +251,14 @@ struct string_list *dir_list_new(const char *dir,
|
|||||||
fill_pathname_join(file_path, dir, name, sizeof(file_path));
|
fill_pathname_join(file_path, dir, name, sizeof(file_path));
|
||||||
|
|
||||||
ret = parse_dir_entry(name, file_path, is_dir,
|
ret = parse_dir_entry(name, file_path, is_dir,
|
||||||
include_dirs, list, ext_list, file_ext);
|
include_dirs, include_compressed, list, ext_list, file_ext);
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (ret == 1)
|
if (ret == 1)
|
||||||
continue;
|
continue;
|
||||||
}while (FindNextFile(hFind, &ffd) != 0);
|
} while (FindNextFile(hFind, &ffd) != 0);
|
||||||
|
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
string_list_free(ext_list);
|
string_list_free(ext_list);
|
||||||
@ -281,7 +285,7 @@ error:
|
|||||||
is_dir = PSP2_S_ISDIR(entry.d_stat.st_mode);
|
is_dir = PSP2_S_ISDIR(entry.d_stat.st_mode);
|
||||||
|
|
||||||
ret = parse_dir_entry(name, file_path, is_dir,
|
ret = parse_dir_entry(name, file_path, is_dir,
|
||||||
include_dirs, list, ext_list, file_ext);
|
include_dirs, include_compressed, list, ext_list, file_ext);
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
@ -318,7 +322,7 @@ error:
|
|||||||
is_dir = dirent_is_directory(file_path, entry);
|
is_dir = dirent_is_directory(file_path, entry);
|
||||||
|
|
||||||
ret = parse_dir_entry(name, file_path, is_dir,
|
ret = parse_dir_entry(name, file_path, is_dir,
|
||||||
include_dirs, list, ext_list, file_ext);
|
include_dirs, include_compressed, list, ext_list, file_ext);
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
goto error;
|
goto error;
|
||||||
@ -333,7 +337,6 @@ error:
|
|||||||
return list;
|
return list;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
||||||
if (directory)
|
if (directory)
|
||||||
closedir(directory);
|
closedir(directory);
|
||||||
#endif
|
#endif
|
||||||
|
@ -105,13 +105,14 @@ static bool dirent_is_directory(const char *path)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* parse_dir_entry:
|
* parse_dir_entry:
|
||||||
* @name : name of the directory listing entry.
|
* @name : name of the directory listing entry.
|
||||||
* @file_path : file path of the directory listing entry.
|
* @file_path : file path of the directory listing entry.
|
||||||
* @is_dir : is the directory listing a directory?
|
* @is_dir : is the directory listing a directory?
|
||||||
* @include_dirs : include directories as part of the finished directory listing?
|
* @include_dirs : include directories as part of the finished directory listing?
|
||||||
* @list : pointer to directory listing.
|
* @include_compressed : include compressed files, even when not part of ext_list.
|
||||||
* @ext_list : pointer to allowed file extensions listing.
|
* @list : pointer to directory listing.
|
||||||
* @file_ext : file extension of the directory listing entry.
|
* @ext_list : pointer to allowed file extensions listing.
|
||||||
|
* @file_ext : file extension of the directory listing entry.
|
||||||
*
|
*
|
||||||
* Parses a directory listing.
|
* Parses a directory listing.
|
||||||
*
|
*
|
||||||
@ -119,7 +120,7 @@ static bool dirent_is_directory(const char *path)
|
|||||||
* continue to the next entry in the directory listing.
|
* continue to the next entry in the directory listing.
|
||||||
**/
|
**/
|
||||||
static int parse_dir_entry(const char *name, char *file_path,
|
static int parse_dir_entry(const char *name, char *file_path,
|
||||||
bool is_dir, bool include_dirs,
|
bool is_dir, bool include_dirs, bool include_compressed,
|
||||||
struct string_list *list, struct string_list *ext_list,
|
struct string_list *list, struct string_list *ext_list,
|
||||||
const char *file_ext)
|
const char *file_ext)
|
||||||
{
|
{
|
||||||
@ -142,7 +143,9 @@ static int parse_dir_entry(const char *name, char *file_path,
|
|||||||
if (!strcmp(name, ".") || !strcmp(name, ".."))
|
if (!strcmp(name, ".") || !strcmp(name, ".."))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (!is_compressed_file && !is_dir && ext_list && !supported_by_core)
|
if (!is_dir && ext_list &&
|
||||||
|
((!is_compressed_file && !supported_by_core) ||
|
||||||
|
(!supported_by_core && !include_compressed)))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (is_dir)
|
if (is_dir)
|
||||||
@ -168,9 +171,10 @@ static int parse_dir_entry(const char *name, char *file_path,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* dir_list_new:
|
* dir_list_new:
|
||||||
* @dir : directory path.
|
* @dir : directory path.
|
||||||
* @ext : allowed extensions of file directory entries to include.
|
* @ext : allowed extensions of file directory entries to include.
|
||||||
* @include_dirs : include directories as part of the finished directory listing?
|
* @include_dirs : include directories as part of the finished directory listing?
|
||||||
|
* @include_compressed : Include compressed files, even if not part of ext.
|
||||||
*
|
*
|
||||||
* Create a directory listing.
|
* Create a directory listing.
|
||||||
*
|
*
|
||||||
@ -178,7 +182,7 @@ static int parse_dir_entry(const char *name, char *file_path,
|
|||||||
* NULL in case of error. Has to be freed manually.
|
* NULL in case of error. Has to be freed manually.
|
||||||
**/
|
**/
|
||||||
struct string_list *dir_list_new(const char *dir,
|
struct string_list *dir_list_new(const char *dir,
|
||||||
const char *ext, bool include_dirs)
|
const char *ext, bool include_dirs, bool include_compressed)
|
||||||
{
|
{
|
||||||
NSArray *entries = NULL;
|
NSArray *entries = NULL;
|
||||||
char path_buf[PATH_MAX_LENGTH] = {0};
|
char path_buf[PATH_MAX_LENGTH] = {0};
|
||||||
@ -207,7 +211,7 @@ struct string_list *dir_list_new(const char *dir,
|
|||||||
is_dir = dirent_is_directory(file_path);
|
is_dir = dirent_is_directory(file_path);
|
||||||
|
|
||||||
ret = parse_dir_entry([name UTF8String], file_path, is_dir,
|
ret = parse_dir_entry([name UTF8String], file_path, is_dir,
|
||||||
include_dirs, list, ext_list, file_ext);
|
include_dirs, include_compressed, list, ext_list, file_ext);
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -31,9 +31,10 @@ extern "C" {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* dir_list_new:
|
* dir_list_new:
|
||||||
* @dir : directory path.
|
* @dir : directory path.
|
||||||
* @ext : allowed extensions of file directory entries to include.
|
* @ext : allowed extensions of file directory entries to include.
|
||||||
* @include_dirs : include directories as part of the finished directory listing?
|
* @include_dirs : include directories as part of the finished directory listing?
|
||||||
|
* @include_compressed : include compressed files, even when not part of ext.
|
||||||
*
|
*
|
||||||
* Create a directory listing.
|
* Create a directory listing.
|
||||||
*
|
*
|
||||||
@ -41,7 +42,7 @@ extern "C" {
|
|||||||
* NULL in case of error. Has to be freed manually.
|
* NULL in case of error. Has to be freed manually.
|
||||||
**/
|
**/
|
||||||
struct string_list *dir_list_new(const char *dir, const char *ext,
|
struct string_list *dir_list_new(const char *dir, const char *ext,
|
||||||
bool include_dirs);
|
bool include_dirs, bool include_compressed);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dir_list_sort:
|
* dir_list_sort:
|
||||||
|
@ -2118,7 +2118,7 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool *n
|
|||||||
else
|
else
|
||||||
str_list = dir_list_new(info->path,
|
str_list = dir_list_new(info->path,
|
||||||
filter_ext ? info->exts : NULL,
|
filter_ext ? info->exts : NULL,
|
||||||
true);
|
true, true);
|
||||||
|
|
||||||
if (hash_label == MENU_LABEL_SCAN_DIRECTORY)
|
if (hash_label == MENU_LABEL_SCAN_DIRECTORY)
|
||||||
menu_list_push(info->list,
|
menu_list_push(info->list,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user