f
This commit is contained in:
@@ -29,9 +29,17 @@ end
|
||||
if type(scripts_root) ~= 'string' then
|
||||
scripts_root = ''
|
||||
end
|
||||
|
||||
local msg = require('mp.msg')
|
||||
msg.info('[uosc-shim] loading uosc...')
|
||||
|
||||
-- Your current folder layout is: scripts/uosc/scripts/uosc/main.lua
|
||||
local uosc_dir = utils.join_path(scripts_root, 'uosc/scripts/uosc')
|
||||
|
||||
if not utils.file_info(utils.join_path(uosc_dir, 'main.lua')) then
|
||||
msg.error('[uosc-shim] ERROR: main.lua not found at ' .. tostring(uosc_dir))
|
||||
end
|
||||
|
||||
-- uosc uses mp.get_script_directory() to find its adjacent resources (bin/, lib/, etc).
|
||||
-- Because this loader lives in scripts/, override it so uosc resolves paths correctly.
|
||||
local _orig_get_script_directory = mp.get_script_directory
|
||||
@@ -41,4 +49,11 @@ end
|
||||
|
||||
add_package_path(uosc_dir)
|
||||
|
||||
dofile(utils.join_path(uosc_dir, 'main.lua'))
|
||||
local ok, err = pcall(dofile, utils.join_path(uosc_dir, 'main.lua'))
|
||||
if not ok then
|
||||
msg.error('[uosc-shim] ERROR during dofile: ' .. tostring(err))
|
||||
else
|
||||
msg.info('[uosc-shim] uosc loaded successfully')
|
||||
-- Notify main.lua that we are alive
|
||||
mp.commandv('script-message', 'uosc-version', 'bundled')
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user