Commit b9baae25 authored by Christophe Massiot's avatar Christophe Massiot

* modules/control/http.c: Support for ~ in foreach directory.

parent 4e69a722
......@@ -1212,7 +1212,7 @@ static mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name,
char *psz_dir )
{
mvar_t *s = mvar_New( name, "set" );
char tmp[MAX_DIR_SIZE], *p, *src;
char tmp[MAX_DIR_SIZE], dir[MAX_DIR_SIZE], *p, *src;
#ifdef HAVE_SYS_STAT_H
struct stat stat_info;
#endif
......@@ -1255,6 +1255,15 @@ static mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name,
{
return s;
}
if( *psz_dir == '~' )
{
/* This is incomplete : we should also support the ~cmassiot/ syntax. */
snprintf( dir, sizeof(dir), "%s/%s", p_intf->p_vlc->psz_homedir,
psz_dir + 1 );
psz_dir = dir;
}
/* first fix all .. dir */
p = src = psz_dir;
while( *src )
......@@ -1332,7 +1341,7 @@ static mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name,
continue;
}
sprintf( tmp, "%s/%s", psz_dir, p_dir_content->d_name );
snprintf( tmp, sizeof(tmp), "%s/%s", psz_dir, p_dir_content->d_name );
#ifdef HAVE_SYS_STAT_H
if( stat( tmp, &stat_info ) == -1 )
......@@ -1346,7 +1355,7 @@ static mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name,
p_dir_content->d_name );
psz_name = FromUTF8( p_intf, psz_tmp );
free( psz_tmp );
sprintf( tmp, "%s/%s", psz_dir, psz_name );
snprintf( tmp, sizeof(tmp), "%s/%s", psz_dir, psz_name );
mvar_AppendNewVar( f, "name", tmp );
mvar_AppendNewVar( f, "basename", psz_name );
......
......@@ -160,7 +160,7 @@ static int Open( vlc_object_t *p_this )
if( !psz_file )
{
#ifdef SYS_DARWIN
char *psz_homedir = p_this->p_vlc->psz_homedir;
char *psz_homedir = p_this->p_vlc->psz_homedir;
if( !psz_homedir )
{
......@@ -185,7 +185,7 @@ static int Open( vlc_object_t *p_this )
}
}
#else
switch( p_intf->p_sys->i_mode )
switch( p_intf->p_sys->i_mode )
{
case MODE_HTML:
psz_file = strdup( LOG_FILE_HTML );
......
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