mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-31 00:22:31 +00:00
add configuration option to toggle showing hidden files (default on), fixes issue #2769
This commit is contained in:
parent
43b6ce416e
commit
cf4bf344a9
@ -247,7 +247,7 @@ rarch_dsp_filter_t *rarch_dsp_filter_new(
|
||||
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
goto error;
|
||||
|
||||
plugs = dir_list_new(basedir, ext_name, false, false, false);
|
||||
plugs = dir_list_new(basedir, ext_name, false, true, false, false);
|
||||
if (!plugs)
|
||||
goto error;
|
||||
#endif
|
||||
|
@ -511,6 +511,8 @@ static unsigned aspect_ratio_idx = ASPECT_RATIO_CORE;
|
||||
/* Save configuration file on exit. */
|
||||
static bool config_save_on_exit = true;
|
||||
|
||||
static bool show_hidden_files = true;
|
||||
|
||||
static const bool overlay_hide_in_menu = true;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
|
@ -965,6 +965,7 @@ static void config_set_defaults(void)
|
||||
g_defaults.path.config, sizeof(global->path.config));
|
||||
|
||||
settings->config_save_on_exit = config_save_on_exit;
|
||||
settings->show_hidden_files = show_hidden_files;
|
||||
|
||||
/* Avoid reloading config on every content load */
|
||||
if (default_block_config_read)
|
||||
@ -1314,6 +1315,7 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||
{ "sort_savefiles_enable", &settings->sort_savefiles_enable},
|
||||
{ "sort_savestates_enable", &settings->sort_savestates_enable},
|
||||
{ "config_save_on_exit", &settings->config_save_on_exit},
|
||||
{ "show_hidden_files", &settings->show_hidden_files},
|
||||
#ifdef HAVE_MENU
|
||||
{ "dpi_override_enable", &settings->menu.dpi.override_enable},
|
||||
#endif
|
||||
@ -2921,6 +2923,7 @@ int populate_settings_bool(settings_t *settings, struct config_bool_setting *out
|
||||
{ "sort_savefiles_enable", settings->sort_savefiles_enable},
|
||||
{ "sort_savestates_enable", settings->sort_savestates_enable},
|
||||
{ "config_save_on_exit", settings->config_save_on_exit},
|
||||
{ "show_hidden_files", settings->show_hidden_files},
|
||||
{ "input_autodetect_enable", settings->input.autodetect_enable},
|
||||
{ "audio_rate_control", settings->audio.rate_control}
|
||||
};
|
||||
|
@ -495,6 +495,7 @@ typedef struct settings
|
||||
#endif
|
||||
|
||||
bool config_save_on_exit;
|
||||
bool show_hidden_files;
|
||||
|
||||
#ifdef HAVE_LAKKA
|
||||
bool ssh_enable;
|
||||
|
@ -240,7 +240,7 @@ bool IMAGE_CORE_PREFIX(retro_load_game)(const struct retro_game_info *info)
|
||||
path_basedir(dir);
|
||||
|
||||
file_list = dir_list_new(dir, IMAGE_CORE_PREFIX(valid_extensions),
|
||||
false,false,false);
|
||||
false,true,false,false);
|
||||
dir_list_sort(file_list, false);
|
||||
free(dir);
|
||||
|
||||
|
@ -366,7 +366,7 @@ static void *gfx_ctx_drm_init(void *video_driver)
|
||||
return NULL;
|
||||
|
||||
fd = -1;
|
||||
gpu_descriptors = dir_list_new("/dev/dri", NULL, false, false, false);
|
||||
gpu_descriptors = dir_list_new("/dev/dri", NULL, false, true, false, false);
|
||||
|
||||
nextgpu:
|
||||
free_drm_resources(drm);
|
||||
|
@ -409,7 +409,7 @@ rarch_softfilter_t *rarch_softfilter_new(const char *filter_config,
|
||||
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
goto error;
|
||||
|
||||
plugs = dir_list_new(basedir, ext_name, false, false, false);
|
||||
plugs = dir_list_new(basedir, ext_name, false, false, false, false);
|
||||
|
||||
if (!plugs)
|
||||
{
|
||||
|
@ -991,6 +991,10 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
#endif
|
||||
);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_SHOW_HIDDEN_FILES:
|
||||
snprintf(s, len, "Show hidden files\n"
|
||||
"and folders.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS:
|
||||
snprintf(s, len,
|
||||
"Hardware filter for this pass. \n"
|
||||
@ -2518,6 +2522,8 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg)
|
||||
return "auto_overrides_enable";
|
||||
case MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT:
|
||||
return "config_save_on_exit";
|
||||
case MENU_ENUM_LABEL_SHOW_HIDDEN_FILES:
|
||||
return "show_hidden_files";
|
||||
case MENU_ENUM_LABEL_VIDEO_SMOOTH:
|
||||
return "video_smooth";
|
||||
case MENU_ENUM_LABEL_VIDEO_GAMMA:
|
||||
@ -3841,6 +3847,8 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg)
|
||||
return "Load Override Files Automatically";
|
||||
case MENU_ENUM_LABEL_VALUE_CONFIG_SAVE_ON_EXIT:
|
||||
return "Save Configuration On Exit";
|
||||
case MENU_ENUM_LABEL_VALUE_SHOW_HIDDEN_FILES:
|
||||
return "Show Hidden Files and Folders";
|
||||
case MENU_ENUM_LABEL_VALUE_VIDEO_SMOOTH:
|
||||
return "HW Bilinear Filtering";
|
||||
case MENU_ENUM_LABEL_VALUE_VIDEO_GAMMA:
|
||||
|
@ -34,7 +34,9 @@ RETRO_BEGIN_DECLS
|
||||
* @dir : directory path.
|
||||
* @ext : allowed extensions of file directory entries to include.
|
||||
* @include_dirs : include directories as part of the finished directory listing?
|
||||
* @include_hidden : include hidden files and directories as part of the finished directory listing?
|
||||
* @include_compressed : include compressed files, even when not part of ext.
|
||||
* @recursive : list directory contents recursively
|
||||
*
|
||||
* Create a directory listing.
|
||||
*
|
||||
@ -42,7 +44,7 @@ RETRO_BEGIN_DECLS
|
||||
* NULL in case of error. Has to be freed manually.
|
||||
**/
|
||||
struct string_list *dir_list_new(const char *dir, const char *ext,
|
||||
bool include_dirs, bool include_compressed, bool recursive);
|
||||
bool include_dirs, bool include_hidden, bool include_compressed, bool recursive);
|
||||
|
||||
/**
|
||||
* dir_list_sort:
|
||||
@ -69,13 +71,16 @@ void dir_list_free(struct string_list *list);
|
||||
* @list : the string list to add files to
|
||||
* @ext_list : the string list of extensions to include
|
||||
* @include_dirs : include directories as part of the finished directory listing?
|
||||
* @include_hidden : include hidden files and directories as part of the finished directory listing?
|
||||
* @include_compressed : Only include files which match ext. Do not try to match compressed files, etc.
|
||||
* @recursive : list directory contents recursively
|
||||
*
|
||||
* Add files within a directory to an existing string list
|
||||
*
|
||||
* Returns: -1 on error, 0 on success.
|
||||
**/
|
||||
int dir_list_read(const char *dir, struct string_list *list, struct string_list *ext_list, bool include_dirs, bool include_compressed, bool recursive);
|
||||
int dir_list_read(const char *dir, struct string_list *list, struct string_list *ext_list,
|
||||
bool include_dirs, bool include_hidden, bool include_compressed, bool recursive);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
|
@ -151,7 +151,9 @@ static int parse_dir_entry(const char *name, char *file_path,
|
||||
* @dir : directory path.
|
||||
* @ext : allowed extensions of file directory entries to include.
|
||||
* @include_dirs : include directories as part of the finished directory listing?
|
||||
* @include_hidden : include hidden files and directories as part of the finished directory listing?
|
||||
* @include_compressed : Only include files which match ext. Do not try to match compressed files, etc.
|
||||
* @recursive : list directory contents recursively
|
||||
*
|
||||
* Create a directory listing.
|
||||
*
|
||||
@ -159,7 +161,7 @@ static int parse_dir_entry(const char *name, char *file_path,
|
||||
* NULL in case of error. Has to be freed manually.
|
||||
**/
|
||||
struct string_list *dir_list_new(const char *dir,
|
||||
const char *ext, bool include_dirs, bool include_compressed, bool recursive)
|
||||
const char *ext, bool include_dirs, bool include_hidden, bool include_compressed, bool recursive)
|
||||
{
|
||||
struct string_list *ext_list = NULL;
|
||||
struct string_list *list = NULL;
|
||||
@ -170,7 +172,7 @@ struct string_list *dir_list_new(const char *dir,
|
||||
if (ext)
|
||||
ext_list = string_split(ext, "|");
|
||||
|
||||
if(dir_list_read(dir, list, ext_list, include_dirs, include_compressed, recursive) == -1) {
|
||||
if(dir_list_read(dir, list, ext_list, include_dirs, include_hidden, include_compressed, recursive) == -1) {
|
||||
string_list_free(list);
|
||||
string_list_free(ext_list);
|
||||
return NULL;
|
||||
@ -186,13 +188,15 @@ struct string_list *dir_list_new(const char *dir,
|
||||
* @list : the string list to add files to
|
||||
* @ext_list : the string list of extensions to include
|
||||
* @include_dirs : include directories as part of the finished directory listing?
|
||||
* @include_hidden : include hidden files and directories as part of the finished directory listing?
|
||||
* @include_compressed : Only include files which match ext. Do not try to match compressed files, etc.
|
||||
* @recursive : list directory contents recursively
|
||||
*
|
||||
* Add files within a directory to an existing string list
|
||||
*
|
||||
* Returns: -1 on error, 0 on success.
|
||||
**/
|
||||
int dir_list_read(const char *dir, struct string_list *list, struct string_list *ext_list, bool include_dirs, bool include_compressed, bool recursive)
|
||||
int dir_list_read(const char *dir, struct string_list *list, struct string_list *ext_list, bool include_dirs, bool include_hidden, bool include_compressed, bool recursive)
|
||||
{
|
||||
struct RDIR *entry = retro_opendir(dir);
|
||||
|
||||
@ -205,6 +209,13 @@ int dir_list_read(const char *dir, struct string_list *list, struct string_list
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (include_hidden)
|
||||
entry.dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN;
|
||||
else
|
||||
entry.dwFileAttributes &= ~FILE_ATTRIBUTE_HIDDEN;
|
||||
#endif
|
||||
|
||||
while (retro_readdir(entry))
|
||||
{
|
||||
bool is_dir = false;
|
||||
@ -216,11 +227,17 @@ int dir_list_read(const char *dir, struct string_list *list, struct string_list
|
||||
fill_pathname_join(file_path, dir, name, sizeof(file_path));
|
||||
is_dir = retro_dirent_is_dir(entry, file_path);
|
||||
|
||||
if (!include_hidden)
|
||||
{
|
||||
if (*name == '.')
|
||||
continue;
|
||||
}
|
||||
|
||||
if(is_dir && recursive) {
|
||||
if(strncmp(name, ".", 1) == 0 || strncmp(name, "..", 2) == 0)
|
||||
if(strstr(name, ".") || strstr(name, ".."))
|
||||
continue;
|
||||
|
||||
dir_list_read(file_path, list, ext_list, include_dirs, include_compressed, recursive);
|
||||
dir_list_read(file_path, list, ext_list, include_dirs, include_hidden, include_compressed, recursive);
|
||||
}
|
||||
|
||||
ret = parse_dir_entry(name, file_path, is_dir,
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "audio/audio_driver.h"
|
||||
#include "audio/audio_resampler_driver.h"
|
||||
#include "record/record_driver.h"
|
||||
#include "configuration.h"
|
||||
|
||||
struct string_list *dir_list_new_special(const char *input_dir,
|
||||
enum dir_list_type type, const char *filter)
|
||||
@ -54,6 +55,7 @@ struct string_list *dir_list_new_special(const char *input_dir,
|
||||
const char *exts = NULL;
|
||||
bool include_dirs = false;
|
||||
bool recursive = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)input_dir;
|
||||
|
||||
@ -135,7 +137,7 @@ struct string_list *dir_list_new_special(const char *input_dir,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return dir_list_new(dir, exts, include_dirs, type == DIR_LIST_CORE_INFO, recursive);
|
||||
return dir_list_new(dir, exts, include_dirs, settings->show_hidden_files, type == DIR_LIST_CORE_INFO, recursive);
|
||||
}
|
||||
|
||||
struct string_list *string_list_new_special(enum string_list_type type,
|
||||
|
@ -3165,6 +3165,7 @@ static int menu_displaylist_parse_playlists(
|
||||
size_t i, list_size;
|
||||
struct string_list *str_list = NULL;
|
||||
unsigned items_found = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!*info->path)
|
||||
{
|
||||
@ -3174,7 +3175,7 @@ static int menu_displaylist_parse_playlists(
|
||||
return 0;
|
||||
}
|
||||
|
||||
str_list = dir_list_new(info->path, NULL, true, true, false);
|
||||
str_list = dir_list_new(info->path, NULL, true, settings->show_hidden_files, true, false);
|
||||
|
||||
if (!str_list)
|
||||
{
|
||||
@ -3272,6 +3273,7 @@ static int menu_displaylist_parse_cores(
|
||||
bool filter_ext = true;
|
||||
struct string_list *str_list = NULL;
|
||||
unsigned items_found = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!*info->path)
|
||||
{
|
||||
@ -3283,7 +3285,7 @@ static int menu_displaylist_parse_cores(
|
||||
|
||||
str_list = dir_list_new(info->path,
|
||||
filter_ext ? info->exts : NULL,
|
||||
true, true, false);
|
||||
true, settings->show_hidden_files, true, false);
|
||||
|
||||
{
|
||||
char out_dir[PATH_MAX_LENGTH] = {0};
|
||||
@ -3489,7 +3491,7 @@ static int menu_displaylist_parse_generic(
|
||||
else
|
||||
str_list = dir_list_new(info->path,
|
||||
filter_ext ? info->exts : NULL,
|
||||
true, true, false);
|
||||
true, settings->show_hidden_files, true, false);
|
||||
|
||||
#ifdef HAVE_LIBRETRODB
|
||||
if (BIT32_GET(filebrowser_types, FILEBROWSER_SCAN_DIR))
|
||||
@ -4474,6 +4476,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_AUTO_REMAPS_ENABLE,
|
||||
PARSE_ONLY_BOOL, false);
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_SHOW_HIDDEN_FILES,
|
||||
PARSE_ONLY_BOOL, false);
|
||||
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
|
@ -4711,6 +4711,22 @@ static bool setting_append_list(
|
||||
SD_FLAG_NONE);
|
||||
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT);
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->show_hidden_files,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_SHOW_HIDDEN_FILES),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHOW_HIDDEN_FILES),
|
||||
show_hidden_files,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON),
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler,
|
||||
SD_FLAG_NONE);
|
||||
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_SHOW_HIDDEN_FILES);
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->game_specific_options,
|
||||
|
@ -1147,6 +1147,9 @@ enum msg_hash_enums
|
||||
MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT,
|
||||
MENU_ENUM_LABEL_VALUE_CONFIG_SAVE_ON_EXIT,
|
||||
|
||||
MENU_ENUM_LABEL_SHOW_HIDDEN_FILES,
|
||||
MENU_ENUM_LABEL_VALUE_SHOW_HIDDEN_FILES,
|
||||
|
||||
/* Driver settings */
|
||||
|
||||
MENU_ENUM_LABEL_AUDIO_DRIVER,
|
||||
|
@ -122,6 +122,9 @@
|
||||
# Load up a specific config file based on the core being used.
|
||||
# core_specific_config = false
|
||||
|
||||
# Shows hidden files and folders in directory listings.
|
||||
# show_hidden_files = true
|
||||
|
||||
#### Video
|
||||
|
||||
# Video driver to use. "gl", "xvideo", "sdl"
|
||||
|
Loading…
x
Reference in New Issue
Block a user