From 6a0d4bdd348dbf478bbad60fd736201b6c85dde0 Mon Sep 17 00:00:00 2001 From: Antoine Cellerier Date: Fri, 26 Feb 2010 11:07:42 +0100 Subject: [PATCH] Include all authorized lua extensions in module search path too. --- modules/misc/lua/vlc.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/modules/misc/lua/vlc.c b/modules/misc/lua/vlc.c index 9bf2babdb8..efe0b1f643 100644 --- a/modules/misc/lua/vlc.c +++ b/modules/misc/lua/vlc.c @@ -704,20 +704,23 @@ error: static int vlclua_add_modules_path_inner( lua_State *L, const char *psz_path ) { /* FIXME: don't use luaL_dostring */ - char *psz_command = NULL; - if( asprintf( &psz_command, - "package.path =[[%s"DIR_SEP"modules"DIR_SEP"?.lua;]]..package.path", - psz_path ) < 0 ) + for( const char **ppsz_ext = ppsz_lua_exts; *ppsz_ext; ppsz_ext++ ) { - return 1; - } + char *psz_command = NULL; + if( asprintf( &psz_command, + "package.path =[[%s"DIR_SEP"modules"DIR_SEP"?.%s;]]..package.path", + psz_path, *ppsz_ext ) < 0 ) + { + return 1; + } - if( luaL_dostring( L, psz_command ) ) - { + if( luaL_dostring( L, psz_command ) ) + { + free( psz_command ); + return 1; + } free( psz_command ); - return 1; } - free( psz_command ); return 0; } -- 2.39.5