This commit is contained in:
nose
2025-12-07 00:21:30 -08:00
parent f29709d951
commit 6b05dc5552
23 changed files with 2196 additions and 1133 deletions

View File

@@ -11,12 +11,32 @@ local opts = {
}
-- Detect CLI path
local script_dir = mp.get_script_directory()
local function detect_script_dir()
local dir = mp.get_script_directory()
if dir and dir ~= "" then return dir end
-- Fallback to debug info path
local src = debug.getinfo(1, "S").source
if src and src:sub(1, 1) == "@" then
local path = src:sub(2)
local parent = path:match("(.*)[/\\]")
if parent and parent ~= "" then
return parent
end
end
-- Fallback to working directory
local cwd = utils.getcwd()
if cwd and cwd ~= "" then return cwd end
return nil
end
local script_dir = detect_script_dir() or ""
if not opts.cli_path then
-- Assuming the structure is repo/LUA/script.lua and repo/CLI.py
-- We need to go up one level
local parent_dir = script_dir:match("(.*)[/\\]")
if parent_dir then
if parent_dir and parent_dir ~= "" then
opts.cli_path = parent_dir .. "/CLI.py"
else
opts.cli_path = "CLI.py" -- Fallback