summaryrefslogtreecommitdiffstats
path: root/player/lua/ytdl_hook.lua
diff options
context:
space:
mode:
authorRicardo Constantino <wiiaboo@gmail.com>2018-01-12 18:17:37 +0000
committerRicardo Constantino <wiiaboo@gmail.com>2018-01-12 18:17:37 +0000
commitb478d2b1ce7a84fb25e796281ca537c632ca8f07 (patch)
tree5caca1dee92a0d390b3fe0b9befb430a7f4bf741 /player/lua/ytdl_hook.lua
parent2d6fdccb9230f3486573bb6cec85e1fbfb000ca1 (diff)
downloadmpv-b478d2b1ce7a84fb25e796281ca537c632ca8f07.tar.bz2
mpv-b478d2b1ce7a84fb25e796281ca537c632ca8f07.tar.xz
ytdl_hook: look for the right ytdl binary according to system
package.config is available in 5.1, 5.2, 5.3 and luajit, so should be fine. The first character is the path separator, so it's '\' on windows and '/' on *nix. This should also prevent cases where users download the wrong binary.
Diffstat (limited to 'player/lua/ytdl_hook.lua')
-rw-r--r--player/lua/ytdl_hook.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index 5416a7ff07..91f5960ade 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -310,7 +310,8 @@ mp.add_hook(o.try_ytdl_first and "on_load" or "on_load_fail", 10, function ()
-- check for youtube-dl in mpv's config dir
if not (ytdl.searched) then
- local ytdl_mcd = mp.find_config_file("youtube-dl")
+ local exesuf = (package.config:sub(1,1) == '\\') and '.exe' or ''
+ local ytdl_mcd = mp.find_config_file("youtube-dl" .. exesuf)
if not (ytdl_mcd == nil) then
msg.verbose("found youtube-dl at: " .. ytdl_mcd)
ytdl.path = ytdl_mcd