summaryrefslogtreecommitdiffstats
path: root/player/javascript
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2022-02-04 12:44:13 +0200
committerAvi Halachmi (:avih) <avihpit@yahoo.com>2022-02-04 12:53:16 +0200
commit7849a36beb458985d1e8b15bd2706a6e084a5f33 (patch)
tree529faa87b51e008f40d38ac5ce035ea8c770a511 /player/javascript
parent5d31c7310c02767e35bfd82d1cc635427518a298 (diff)
downloadmpv-7849a36beb458985d1e8b15bd2706a6e084a5f33.tar.bz2
mpv-7849a36beb458985d1e8b15bd2706a6e084a5f33.tar.xz
js: utils.get_user_path: make wrapper of expand-path
When utils.get_user_path was added, the expand-path command didn't exist. Now it does, so remove the C code, make it a trivial wrapper. Keep this function for backward compat to not break scripts, but technically it's not required anymore.
Diffstat (limited to 'player/javascript')
-rw-r--r--player/javascript/defaults.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/player/javascript/defaults.js b/player/javascript/defaults.js
index bf83f42204..a938ffef65 100644
--- a/player/javascript/defaults.js
+++ b/player/javascript/defaults.js
@@ -674,6 +674,8 @@ mp.get_script_directory = function() { return mp.script_path };
mp.get_time = function() { return mp.get_time_ms() / 1000 };
mp.utils.getcwd = function() { return mp.get_property("working-directory") };
mp.utils.getpid = function() { return mp.get_property_number("pid") }
+mp.utils.get_user_path =
+ function(p) { return mp.command_native(["expand-path", String(p)]) };
mp.get_mouse_pos = function() { return mp.get_property_native("mouse-pos") };
mp.utils.write_file = mp.utils._write_file.bind(null, false);
mp.utils.append_file = mp.utils._write_file.bind(null, true);