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

Rémi Denis-Courmont git at videolan.org
Mon Jan 15 18:03:02 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jan 15 19:01:37 2018 +0200| [272e0c47f84e7945ff4d436e4a4958100476e314] | committer: Rémi Denis-Courmont

lua: don't scan same directory twice

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

 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