From b478d2b1ce7a84fb25e796281ca537c632ca8f07 Mon Sep 17 00:00:00 2001 From: Ricardo Constantino Date: Fri, 12 Jan 2018 18:17:37 +0000 Subject: 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. --- player/lua/ytdl_hook.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3