Commit f9d4021d authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Fix the directory 'ignore' mode which skips .jpg's, nfo's etc when opening directories.

parent d6fb7fa7
......@@ -395,26 +395,38 @@ static int ReadDir( playlist_t *p_playlist,
playlist_item_t *p_node;
/* Build array with ignores */
#ifdef HAVE_STRSEP
char **ppsz_extensions = 0;
int i_extensions = 0;
char *psz_ignore = var_CreateGetString( p_playlist, "ignore-filetypes" );
if( psz_ignore && *psz_ignore )
{
char *psz_backup;
char *psz_parser = psz_backup = strdup( psz_ignore );
int a = 0;
char *psz_parser = psz_ignore;
int a;
while( strsep( &psz_parser, "," ) ) i_extensions++;
free( psz_backup );
for( a = 0; psz_parser[a] != '\0'; a++ )
{
if( psz_parser[a] == ',' ) i_extensions++;
}
ppsz_extensions = (char **)malloc( sizeof( char * ) * i_extensions );
psz_parser = psz_ignore;
while( a < i_extensions &&
( ppsz_extensions[a++] = strsep( &psz_parser, "," ) ) );
for( a = 0; a < i_extensions; a++ )
{
int b;
char *tmp;
while( psz_parser[0] != '\0' && psz_parser[0] == ' ' ) psz_parser++;
for( b = 0; psz_parser[b] != '\0'; b++ )
{
if( psz_parser[b] == ',' ) break;
}
tmp = malloc( b + 1 );
strncpy( tmp, psz_parser, b );
tmp[b] = 0;
ppsz_extensions[a] = tmp;
psz_parser += b+1;
}
}
#endif /* HAVE_STRSEP */
/* Change the item to a node */
if( p_parent->i_children == -1 )
......@@ -498,7 +510,6 @@ static int ReadDir( playlist_t *p_playlist,
playlist_item_t *p_item;
char *psz_tmp1, *psz_tmp2, *psz_loc;
#ifdef HAVE_STRSEP
if( i_extensions > 0 )
{
char *psz_dot = strrchr( p_dir_content->d_name, '.' );
......@@ -518,7 +529,6 @@ static int ReadDir( playlist_t *p_playlist,
}
}
}
#endif /* HAVE_STRSEP */
psz_loc = FromLocale( psz_uri );
psz_tmp1 = vlc_fix_readdir_charset( VLC_OBJECT(p_playlist),
......@@ -543,10 +553,13 @@ static int ReadDir( playlist_t *p_playlist,
free( psz_uri );
}
#ifdef HAVE_STRSEP
for( i = 0; i < i_extensions; i++ )
{
if( ppsz_extensions[i] )
free( ppsz_extensions[i] );
}
if( ppsz_extensions ) free( ppsz_extensions );
if( psz_ignore ) free( psz_ignore );
#endif /* HAVE_STRSEP */
free( pp_dir_content );
return VLC_SUCCESS;
......
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