be separator-agnostic when constructing config path

related to #25
This commit is contained in:
Ren Tatsumoto 2023-12-07 01:01:05 +03:00
parent 509b6b6245
commit 3a1621c844

View file

@ -631,8 +631,8 @@ function pref_menu:save()
video_codec = true, video_codec = true,
audio_codec = true, audio_codec = true,
} }
local mpv_dirpath = string.gsub(mp.get_script_directory(), "scripts/%w+", "") local mpv_dirpath = string.gsub(mp.get_script_directory(), "scripts[\\/]%w+", "")
local config_filepath = utils.join_path(mpv_dirpath, string.format('script-opts/%s.conf', NAME)) local config_filepath = utils.join_path(utils.join_path(mpv_dirpath, "script-opts"), string.format('%s.conf', NAME))
local handle = io.open(config_filepath, 'w') local handle = io.open(config_filepath, 'w')
if handle ~= nil then if handle ~= nil then
handle:write(string.format("# Written by %s on %s.\n", NAME, os.date())) handle:write(string.format("# Written by %s on %s.\n", NAME, os.date()))