[vlc-devel] [PATCH] Revert "lua: don't call directly config_GetLibDir"

Nicolas Chauvet kwizart at gmail.com
Mon Jul 31 11:57:18 CEST 2017

This fix lua modules loading such as http interface and youtube scripts.

libdir and datadir are differents kind of directories on Linux.
The former is for arch dependent content whereas the latter is arch

In the case of luac files, the man luac page says
"Precompiled chunks are not portable across different architectures."
So theses files qualifies as been located in a "libdir" directory

Please note that with this revert vlc -vv shows (lua demux meta debug):
Trying Lua scripts in /home/kwizart/.local/share/vlc/lua/meta/reader
Trying Lua scripts in /usr/lib64/vlc/lua/meta/reader
Trying Lua playlist script /usr/lib64/vlc/lua/meta/reader/filename.luac
Trying Lua scripts in /usr/share/vlc/lua/meta/reader
Whereas the /usr/lib64/vlc/lua directory isn't used without the revert.
Also the "architectural dependant luac files" are correctly installed in the right

This reverts commit d5ac6c4ce3d9f50b7bf9e9325b8c9f93b376c574.
 modules/lua/vlc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/modules/lua/vlc.c b/modules/lua/vlc.c
index 512d9e505c..57dc7d8e49 100644
--- a/modules/lua/vlc.c
+++ b/modules/lua/vlc.c
@@ -214,6 +214,17 @@ int vlclua_dir_list( const char *luadirname, char ***pppsz_dir_list )
     free( datadir );
+#if !(defined(__APPLE__) || defined(_WIN32))
+    char *psz_libpath = config_GetLibDir();
+    if( likely(psz_libpath != NULL) )
+    {
+        if( likely(asprintf( &ppsz_dir_list[i], "%s"DIR_SEP"lua"DIR_SEP"%s",
+                             psz_libpath, luadirname ) != -1) )
+            i++;
+        free( psz_libpath );
+    }
     char *psz_datapath = config_GetDataDir();
     if( likely(psz_datapath != NULL) )

More information about the vlc-devel mailing list