From 39e04e929483847a3e0722d86d53f69837ed99db Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Mon, 15 Dec 2014 01:31:30 +0200 Subject: options: deprecate 'lua' based options/dirs for 'script' - --lua and --lua-opts change to --script and --script-opts - 'lua' default script dirs change to 'scripts' - DOCS updated - 'lua-settings' dir was _not_ modified The old lua-based names/dirs still work, but display a warning. Signed-off-by: wm4 --- player/scripting.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'player/scripting.c') diff --git a/player/scripting.c b/player/scripting.c index f2ddcec2aa..2ad45075b0 100644 --- a/player/scripting.c +++ b/player/scripting.c @@ -179,7 +179,7 @@ void mp_load_scripts(struct MPContext *mpctx) mp_load_script(mpctx, "@osc.lua"); if (mpctx->opts->lua_load_ytdl) mp_load_script(mpctx, "@ytdl_hook.lua"); - char **files = mpctx->opts->lua_files; + char **files = mpctx->opts->script_files; for (int n = 0; files && files[n]; n++) { if (files[n][0]) mp_load_script(mpctx, files[n]); @@ -187,13 +187,24 @@ void mp_load_scripts(struct MPContext *mpctx) if (!mpctx->opts->auto_load_scripts) return; - // Load all lua scripts + // Load all scripts void *tmp = talloc_new(NULL); - char **luadir = mp_find_all_config_files(tmp, mpctx->global, "lua"); - for (int i = 0; luadir && luadir[i]; i++) { - files = list_script_files(tmp, luadir[i]); - for (int n = 0; files && files[n]; n++) - mp_load_script(mpctx, files[n]); + const char *dirs[] = {"scripts", "lua", NULL}; // 'lua' is deprecated + int warning_displayed = 0; + for (int s = 0; dirs[s]; s++) { + char **scriptsdir = mp_find_all_config_files(tmp, mpctx->global, dirs[s]); + for (int i = 0; scriptsdir && scriptsdir[i]; i++) { + files = list_script_files(tmp, scriptsdir[i]); + for (int n = 0; files && files[n]; n++) { + if (s && !warning_displayed) { + warning_displayed = 1; + MP_WARN(mpctx, + "warning: '%s' - '%s' dirs are deprecated. Please move scripts to '%s'.", + files[n], dirs[s], dirs[0]); + } + mp_load_script(mpctx, files[n]); + } + } } talloc_free(tmp); } -- cgit v1.2.3