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