Commit 4e3be6eb authored by Christophe Mutricy's avatar Christophe Mutricy

Check for the good directory.

Fix some warnings
parent 6d872fb4
...@@ -259,24 +259,23 @@ int vlclua_scripts_batch_execute( vlc_object_t *p_this, ...@@ -259,24 +259,23 @@ int vlclua_scripts_batch_execute( vlc_object_t *p_this,
return VLC_ENOMEM; return VLC_ENOMEM;
} }
# else # else
{ if( asprintf( &ppsz_dir_list[1],
"share" DIR_SEP "%s", luadirname ) < 0 )
return VLC_ENOMEM;
# ifdef HAVE_SYS_STAT_H # ifdef HAVE_SYS_STAT_H
{
struct stat stat_info; struct stat stat_info;
if( ( utf8_stat( "share/luaplaylist", &stat_info ) == -1 ) if( ( utf8_stat( ppsz_dir_list[1], &stat_info ) == -1 )
|| !S_ISDIR( stat_info.st_mode ) ) || !S_ISDIR( stat_info.st_mode ) )
{ {
free(ppsz_dir_list[1]);
if( asprintf( &ppsz_dir_list[1], if( asprintf( &ppsz_dir_list[1],
DATA_PATH DIR_SEP "%s", luadirname ) < 0 ) DATA_PATH DIR_SEP "%s", luadirname ) < 0 )
return VLC_ENOMEM; return VLC_ENOMEM;
} }
else
# endif
{
if( asprintf( &ppsz_dir_list[1],
"share" DIR_SEP "%s", luadirname ) < 0 )
return VLC_ENOMEM;
}
} }
# endif
# endif # endif
for( ppsz_dir = ppsz_dir_list; *ppsz_dir; ppsz_dir++ ) for( ppsz_dir = ppsz_dir_list; *ppsz_dir; ppsz_dir++ )
...@@ -308,7 +307,9 @@ int vlclua_scripts_batch_execute( vlc_object_t *p_this, ...@@ -308,7 +307,9 @@ int vlclua_scripts_batch_execute( vlc_object_t *p_this,
for( ppsz_file = ppsz_filelist; ppsz_file < ppsz_fileend; ppsz_file++ ) for( ppsz_file = ppsz_filelist; ppsz_file < ppsz_fileend; ppsz_file++ )
{ {
char *psz_filename; char *psz_filename;
asprintf( &psz_filename, "%s" DIR_SEP "%s", *ppsz_dir, *ppsz_file ); if( asprintf( &psz_filename,
"%s" DIR_SEP "%s", *ppsz_dir, *ppsz_file ) < 0)
return VLC_ENOMEM;
msg_Dbg( p_this, "Trying Lua playlist script %s", psz_filename ); msg_Dbg( p_this, "Trying Lua playlist script %s", psz_filename );
i_ret = func( p_this, psz_filename, p_state, user_data ); i_ret = func( p_this, psz_filename, p_state, user_data );
......
...@@ -94,3 +94,4 @@ void vlclua_read_custom_meta_data( vlc_object_t *p_this, ...@@ -94,3 +94,4 @@ void vlclua_read_custom_meta_data( vlc_object_t *p_this,
lua_State *p_state, int o, int t, input_item_t *p_input ); lua_State *p_state, int o, int t, input_item_t *p_input );
#endif /* VLC_LUA_H */ #endif /* VLC_LUA_H */
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