mirror of https://github.com/mpv-player/mpv
scripting: expand --script filename for C plugins
This commit is contained in:
parent
d8a3b10f45
commit
b2f756c80e
|
@ -190,10 +190,8 @@ static void add_functions(struct script_ctx *ctx);
|
|||
static void load_file(lua_State *L, const char *fname)
|
||||
{
|
||||
struct script_ctx *ctx = get_ctx(L);
|
||||
char *res_name = mp_get_user_path(NULL, ctx->mpctx->global, fname);
|
||||
MP_VERBOSE(ctx, "loading file %s\n", res_name);
|
||||
int r = luaL_loadfile(L, res_name);
|
||||
talloc_free(res_name); // careful to not leak this on Lua errors
|
||||
MP_VERBOSE(ctx, "loading file %s\n", fname);
|
||||
int r = luaL_loadfile(L, fname);
|
||||
if (r)
|
||||
lua_error(L);
|
||||
lua_call(L, 0, 0);
|
||||
|
|
|
@ -215,8 +215,11 @@ void mp_load_scripts(struct MPContext *mpctx)
|
|||
// Load scripts from options
|
||||
char **files = mpctx->opts->script_files;
|
||||
for (int n = 0; files && files[n]; n++) {
|
||||
if (files[n][0])
|
||||
mp_load_script(mpctx, files[n]);
|
||||
if (files[n][0]) {
|
||||
char *path = mp_get_user_path(NULL, mpctx->global, files[n]);
|
||||
mp_load_script(mpctx, path);
|
||||
talloc_free(path);
|
||||
}
|
||||
}
|
||||
if (!mpctx->opts->auto_load_scripts)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue