[vlc-commits] demux/directory: add show-hiddenfiles option

Thomas Guillem git at videolan.org
Wed May 20 16:10:26 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu May  7 11:59:42 2015 +0200| [fb5f5d1f4dc5058aa8a2a3a349b379ba3be009dc] | committer: Thomas Guillem

demux/directory: add show-hiddenfiles option

False by default, i.e. we don't show hidden files by default.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fb5f5d1f4dc5058aa8a2a3a349b379ba3be009dc
---

 modules/demux/playlist/directory.c |    8 ++++++--
 modules/demux/playlist/playlist.c  |    6 ++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/demux/playlist/directory.c b/modules/demux/playlist/directory.c
index 54b084a..51d3927 100644
--- a/modules/demux/playlist/directory.c
+++ b/modules/demux/playlist/directory.c
@@ -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 ))
diff --git a/modules/demux/playlist/playlist.c b/modules/demux/playlist/playlist.c
index 4d2ae03..243e342 100644
--- a/modules/demux/playlist/playlist.c
+++ b/modules/demux/playlist/playlist.c
@@ -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)



More information about the vlc-commits mailing list