summaryrefslogtreecommitdiffstats
path: root/player/scripting.c
diff options
context:
space:
mode:
authorRicardo Constantino <wiiaboo@gmail.com>2017-06-30 14:53:33 +0100
committerRicardo Constantino <wiiaboo@gmail.com>2017-06-30 15:03:10 +0100
commitc1f46dbbe9a9b2d1ae6694118244bea8859ab2f0 (patch)
tree0a32902bbd9560fa6b941f9e46a12d81b1ed781c /player/scripting.c
parentba8160cf59e4c13c6619c131ae14b29046eb212c (diff)
downloadmpv-c1f46dbbe9a9b2d1ae6694118244bea8859ab2f0.tar.bz2
mpv-c1f46dbbe9a9b2d1ae6694118244bea8859ab2f0.tar.xz
scripting: add wrapper to load scripts with user paths
Fixes regression since b2f756c80e, which broke load-script command when used with user paths (ex: ~~/script.lua)
Diffstat (limited to 'player/scripting.c')
-rw-r--r--player/scripting.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/player/scripting.c b/player/scripting.c
index dc8e7d5b2b..5651950a42 100644
--- a/player/scripting.c
+++ b/player/scripting.c
@@ -155,6 +155,14 @@ int mp_load_script(struct MPContext *mpctx, const char *fname)
return 0;
}
+int mp_load_user_script(struct MPContext *mpctx, const char *fname)
+{
+ char *path = mp_get_user_path(NULL, mpctx->global, fname);
+ int ret = mp_load_script(mpctx, path);
+ talloc_free(path);
+ return ret;
+}
+
static int compare_filename(const void *pa, const void *pb)
{
char *a = (char *)pa;
@@ -219,11 +227,8 @@ 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]) {
- char *path = mp_get_user_path(NULL, mpctx->global, files[n]);
- mp_load_script(mpctx, path);
- talloc_free(path);
- }
+ if (files[n][0])
+ mp_load_user_script(mpctx, files[n]);
}
if (!mpctx->opts->auto_load_scripts)
return;