Changeset 0df4f0cd18ac6ac174a53459447999e62a59190c

Show
Ignore:
Timestamp:
08/16/07 18:48:05 (1 year ago)
Author:
Damien Fouilleul <damienf@videolan.org>
git-committer:
Damien Fouilleul <damienf@videolan.org> 1187282885 +0000
git-parent:

[2dffeb14fb0b1cd571aace3cde1c9c8dcc48eb64]

git-author:
Damien Fouilleul <damienf@videolan.org> 1187282885 +0000
Message:

lua: fixed search paths list for scripts, needs more work for Linux

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/demux/playlist/luaplaylist.c

    r515deca r0df4f0c  
    253253    char **ppsz_file; 
    254254 
    255     char  *ppsz_dir_list[] = { NULL, NULL, NULL }; 
     255    char  *ppsz_dir_list[] = { NULL, NULL, NULL, NULL }; 
    256256    char **ppsz_dir; 
    257257 
     
    290290    lua_pop( p_state, 1 ); 
    291291 
    292     ppsz_dir_list[0] = malloc( strlen( p_demux->p_libvlc->psz_homedir ) 
    293                              + strlen( DIR_SEP CONFIG_DIR DIR_SEP "luaplaylist" ) + 1 ); 
    294     sprintf( ppsz_dir_list[0], "%s" DIR_SEP CONFIG_DIR DIR_SEP "luaplaylist", 
    295              p_demux->p_libvlc->psz_homedir ); 
     292    if( asprintf( &ppsz_dir_list[0], "%s" DIR_SEP CONFIG_DIR DIR_SEP "luaplaylist", 
     293             p_demux->p_libvlc->psz_homedir ) < -1 ) 
     294        return VLC_ENOMEM; 
    296295 
    297296#   if defined(__APPLE__) || defined(SYS_BEOS) || defined(WIN32) 
    298297    { 
    299298        char *psz_vlcpath = config_GetDataDir( p_demux ); 
    300         ppsz_dir_list[1] = malloc( strlen( psz_vlcpath ) + strlen( "luaplaylist" ) + 1 ); 
    301         if( !ppsz_dir_list[1] ) return VLC_ENOMEM; 
    302         sprintf( ppsz_dir_list[1], "%s" DIR_SEP "luaplaylist", psz_vlcpath ); 
     299        if( asprintf( &ppsz_dir_list[1], "%s" DIR_SEP "luaplaylist", psz_vlcpath ) < 0 ) 
     300            return VLC_ENOMEM; 
     301        if( asprintf( &ppsz_dir_list[2], "%s" DIR_SEP "share" DIR_SEP "luaplaylist", psz_vlcpath ) < 0 ) 
     302            return VLC_ENOMEM; 
    303303    } 
    304304#   else 
     
    348348        { 
    349349            free( psz_filename ); psz_filename = NULL; 
    350             asprintf( &psz_filename, "%s/%s", *ppsz_dir, *ppsz_file ); 
     350            asprintf( &psz_filename, "%s" DIR_SEP "%s", *ppsz_dir, *ppsz_file ); 
    351351            msg_Dbg( p_demux, "Trying Lua playlist script %s", psz_filename ); 
    352352            p_demux->p_sys->psz_filename = psz_filename; 
  • modules/meta_engine/luameta.c

    r515deca r0df4f0c  
    293293    char **ppsz_file; 
    294294 
    295     char  *ppsz_dir_list[] = { NULL, NULL, NULL }; 
     295    char  *ppsz_dir_list[] = { NULL, NULL, NULL, NULL }; 
    296296    char **ppsz_dir; 
    297297 
    298     ppsz_dir_list[0] = malloc( strlen( p_this->p_libvlc->psz_homedir ) 
    299                              + strlen( DIR_SEP CONFIG_DIR DIR_SEP ) + strlen( luadirname ) + 1 ); 
    300     sprintf( ppsz_dir_list[0], "%s" DIR_SEP CONFIG_DIR DIR_SEP "%s", 
    301              p_this->p_libvlc->psz_homedir, luadirname ); 
     298    if( asprintf( &ppsz_dir_list[0], "%s" DIR_SEP CONFIG_DIR DIR_SEP "%s", p_this->p_libvlc->psz_homedir, 
     299            luadirname ) < 0 ) 
     300        return VLC_ENOMEM; 
    302301 
    303302#   if defined(__APPLE__) || defined(SYS_BEOS) || defined(WIN32) 
    304303    { 
    305304        const char *psz_vlcpath = config_GetDataDir( p_this ); 
    306         ppsz_dir_list[1] = malloc( strlen( psz_vlcpath ) + strlen( luadirname ) + 1 ); 
    307         if( !ppsz_dir_list[1] ) return VLC_ENOMEM; 
    308         sprintf( ppsz_dir_list[1], "%s" DIR_SEP "%s", psz_vlcpath, luadirname ); 
     305        if( asprintf( &ppsz_dir_list[1], "%s" DIR_SEP "%s", psz_vlcpath, luadirname )  < 0 ) 
     306            return VLC_ENOMEM; 
     307 
     308        if( asprintf( &ppsz_dir_list[2], "%s" DIR_SEP "share" DIR_SEP "%s", psz_vlcpath, luadirname )  < 0 ) 
     309            return VLC_ENOMEM; 
    309310    } 
    310311#   endif