ncurses: make file browser open files
authorRafaël Carré <rafael.carre@gmail.com>
Tue, 18 Aug 2009 22:54:41 +0000 (00:54 +0200)
committerRafaël Carré <rafael.carre@gmail.com>
Tue, 18 Aug 2009 22:55:46 +0000 (00:55 +0200)
all files would be opened as directories

Pointed-out-by: cachereturn on #videolan
modules/gui/ncurses.c

index 8bf7d8f..d23f2a5 100644 (file)
@@ -747,8 +747,15 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
                 if( p_sys->pp_dir_entries[p_sys->i_box_bidx]->b_file || i_key == ' ' )
                 {
                     char* psz_uri;
-                    if( asprintf( &psz_uri, "directory://%s/%s", p_sys->psz_current_dir, p_sys->pp_dir_entries[p_sys->i_box_bidx]->psz_path ) == -1 )
+                    if( asprintf( &psz_uri, "%s://%s/%s",
+                        p_sys->pp_dir_entries[p_sys->i_box_bidx]->b_file ?
+                            "file" : "directory",
+                        p_sys->psz_current_dir,
+                        p_sys->pp_dir_entries[p_sys->i_box_bidx]->psz_path
+                        ) == -1 )
+                    {
                         psz_uri = NULL;
+                    }
 
                     playlist_item_t *p_parent = p_sys->p_node;
                     if( !p_parent )