[vlc-devel] commit: Include all authorized lua extensions in module search path too. ( Antoine Cellerier )

git version control git at videolan.org
Fri Feb 26 11:08:00 CET 2010


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Fri Feb 26 11:07:42 2010 +0100| [6a0d4bdd348dbf478bbad60fd736201b6c85dde0] | committer: Antoine Cellerier 

Include all authorized lua extensions in module search path too.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6a0d4bdd348dbf478bbad60fd736201b6c85dde0
---

 modules/misc/lua/vlc.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/modules/misc/lua/vlc.c b/modules/misc/lua/vlc.c
index 9bf2bab..efe0b1f 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;
 }




More information about the vlc-devel mailing list