Commit fb5f5d1f authored by Thomas Guillem's avatar Thomas Guillem

demux/directory: add show-hiddenfiles option

False by default, i.e. we don't show hidden files by default.
parent 353f77fc
......@@ -149,19 +149,23 @@ static int Demux( demux_t *p_demux )
input_item_node_t *p_node;
input_item_t *p_item;
char *psz_ignored_exts;
bool b_show_hiddenfiles;
p_input = GetCurrentItem( p_demux );
p_node = input_item_node_Create( p_input );
input_item_Release(p_input);
b_show_hiddenfiles = var_InheritBool( p_demux, "show-hiddenfiles" );
psz_ignored_exts = var_InheritString( p_demux, "ignore-filetypes" );
while( !i_ret && ( p_item = stream_ReadDir( p_demux->s ) ) )
{
int i_name_len = p_item->psz_name ? strlen( p_item->psz_name ) : 0;
/* skip "." and ".." items */
if( ( i_name_len == 1 && p_item->psz_name[0] == '.' ) ||
/* skip "." and ".." and hidden files if option is activated */
if( ( !b_show_hiddenfiles && i_name_len > 0 &&
p_item->psz_name[0] == '.' ) ||
( i_name_len == 1 && p_item->psz_name[0] == '.' ) ||
( i_name_len == 2 && p_item->psz_name[0] == '.' &&
p_item->psz_name[1] == '.' ) ||
has_ext( psz_ignored_exts, p_item->psz_name ))
......
......@@ -68,6 +68,10 @@ static const char *const psz_sort_list_text[] = {
"This is useful if you add directories that contain playlist files " \
"for instance. Use a comma-separated list of extensions." )
#define SHOW_HIDDENFILES_TEXT N_("Show hidden files")
#define SHOW_HIDDENFILES_LONGTEXT N_( \
"Ignore files starting with '.'" )
vlc_module_begin ()
add_shortcut( "playlist" )
set_category( CAT_INPUT )
......@@ -166,6 +170,8 @@ vlc_module_begin ()
IGNORE_TEXT, IGNORE_LONGTEXT, false )
add_string( "directory-sort", "collate", SORT_TEXT, SORT_LONGTEXT, false )
change_string_list( psz_sort_list, psz_sort_list_text )
add_bool( "show-hiddenfiles", false,
SHOW_HIDDENFILES_TEXT, SHOW_HIDDENFILES_LONGTEXT, false )
vlc_module_end ()
int Control(demux_t *demux, int query, va_list args)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment