[vlc-commits] lua: don't scan same directory twice

Rémi Denis-Courmont git at videolan.org
Mon Jan 15 19:00:33 CET 2018


vlc/vlc-3.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jan 15 19:01:37 2018 +0200| [965009d3a022bc39600a1c7c7055efc266636ebd] | committer: Jean-Baptiste Kempf

lua: don't scan same directory twice

(cherry picked from commit 272e0c47f84e7945ff4d436e4a4958100476e314)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=965009d3a022bc39600a1c7c7055efc266636ebd
---

 modules/lua/vlc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/lua/vlc.c b/modules/lua/vlc.c
index a7e48bb9ed..ca214c9279 100644
--- a/modules/lua/vlc.c
+++ b/modules/lua/vlc.c
@@ -223,11 +223,16 @@ int vlclua_dir_list(const char *luadirname, char ***restrict listp)
     list = vlclua_dir_list_append(list, config_GetUserDir(VLC_DATA_DIR),
                                   luadirname);
 
+    char *libdir = config_GetLibDir();
+    char *datadir = config_GetDataDir();
+    bool both = strcmp(libdir, datadir);
+
     /* Tokenized Lua scripts in architecture-specific data directory */
-    list = vlclua_dir_list_append(list, config_GetLibDir(), luadirname);
+    list = vlclua_dir_list_append(list, libdir, luadirname);
 
     /* Source Lua Scripts in architecture-independent data directory */
-    list = vlclua_dir_list_append(list, config_GetDataDir(), luadirname);
+    if (both)
+        list = vlclua_dir_list_append(list, datadir, luadirname);
 
     *list = NULL;
     return VLC_SUCCESS;



More information about the vlc-commits mailing list