Commit b3b89b98 authored by Thomas Guillem's avatar Thomas Guillem Committed by Jean-Baptiste Kempf

dsm: change item b_net and i_type

Set b_net to true, and set ITEM_TYPE_DIRECTORY if the item is a share of a
directory.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 4089c841
...@@ -108,7 +108,7 @@ static int login( access_t *p_access ); ...@@ -108,7 +108,7 @@ static int login( access_t *p_access );
static void backslash_path( vlc_url_t *p_url ); static void backslash_path( vlc_url_t *p_url );
static bool get_path( access_t *p_access ); static bool get_path( access_t *p_access );
static int add_item( access_t *p_access, input_item_node_t *p_node, static int add_item( access_t *p_access, input_item_node_t *p_node,
const char *psz_name ); const char *psz_name, int i_type );
struct access_sys_t struct access_sys_t
{ {
...@@ -560,7 +560,7 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -560,7 +560,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
} }
static int add_item( access_t *p_access, input_item_node_t *p_node, static int add_item( access_t *p_access, input_item_node_t *p_node,
const char *psz_name ) const char *psz_name, int i_type )
{ {
access_sys_t *p_sys = p_access->p_sys; access_sys_t *p_sys = p_access->p_sys;
input_item_t *p_item; input_item_t *p_item;
...@@ -571,7 +571,8 @@ static int add_item( access_t *p_access, input_item_node_t *p_node, ...@@ -571,7 +571,8 @@ static int add_item( access_t *p_access, input_item_node_t *p_node,
if( i_ret == -1 ) if( i_ret == -1 )
return VLC_ENOMEM; return VLC_ENOMEM;
p_item = input_item_New( psz_uri, psz_name ); p_item = input_item_NewWithTypeExt( psz_uri, psz_name, 0, NULL, 0, -1,
i_type, 1 );
free( psz_uri ); free( psz_uri );
if( p_item == NULL ) if( p_item == NULL )
return VLC_ENOMEM; return VLC_ENOMEM;
...@@ -623,7 +624,7 @@ static int BrowseShare( access_t *p_access, input_item_node_t *p_node ) ...@@ -623,7 +624,7 @@ static int BrowseShare( access_t *p_access, input_item_node_t *p_node )
if( psz_name[strlen( psz_name ) - 1] == '$') if( psz_name[strlen( psz_name ) - 1] == '$')
continue; continue;
i_ret = add_item( p_access, p_node, psz_name ); i_ret = add_item( p_access, p_node, psz_name, ITEM_TYPE_DIRECTORY );
if( i_ret != VLC_SUCCESS ) if( i_ret != VLC_SUCCESS )
goto error; goto error;
} }
...@@ -662,6 +663,8 @@ static int BrowseDirectory( access_t *p_access, input_item_node_t *p_node ) ...@@ -662,6 +663,8 @@ static int BrowseDirectory( access_t *p_access, input_item_node_t *p_node )
files_count = smb_stat_list_count( files ); files_count = smb_stat_list_count( files );
for( size_t i = 0; i < files_count; i++ ) for( size_t i = 0; i < files_count; i++ )
{ {
int i_type;
st = smb_stat_list_at( files, i ); st = smb_stat_list_at( files, i );
if( st == NULL ) { if( st == NULL ) {
...@@ -674,8 +677,9 @@ static int BrowseDirectory( access_t *p_access, input_item_node_t *p_node ) ...@@ -674,8 +677,9 @@ static int BrowseDirectory( access_t *p_access, input_item_node_t *p_node )
/* Avoid infinite loop */ /* Avoid infinite loop */
if( !strcmp( psz_name, ".") || !strcmp( psz_name, "..") ) if( !strcmp( psz_name, ".") || !strcmp( psz_name, "..") )
continue; continue;
i_type = smb_stat_get( st, SMB_STAT_ISDIR ) ?
i_ret = add_item( p_access, p_node, psz_name ); ITEM_TYPE_DIRECTORY : ITEM_TYPE_FILE;
i_ret = add_item( p_access, p_node, psz_name, i_type );
if( i_ret != VLC_SUCCESS ) if( i_ret != VLC_SUCCESS )
goto error; goto error;
} }
......
...@@ -120,8 +120,8 @@ static void netbios_ns_discover_on_entry_added( void *p_opaque, ...@@ -120,8 +120,8 @@ static void netbios_ns_discover_on_entry_added( void *p_opaque,
if( asprintf(&psz_mrl, "smb://%s", name) < 0 ) if( asprintf(&psz_mrl, "smb://%s", name) < 0 )
return; return;
p_item = input_item_NewWithType( psz_mrl, name, 0, NULL, p_item = input_item_NewWithTypeExt( psz_mrl, name, 0, NULL,
0, -1, ITEM_TYPE_NODE ); 0, -1, ITEM_TYPE_NODE, 1 );
msg_Dbg( p_sd, "Adding item %s", psz_mrl ); msg_Dbg( p_sd, "Adding item %s", psz_mrl );
free(psz_mrl); free(psz_mrl);
......
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