dfd
This commit is contained in:
24
LUA/main.lua
24
LUA/main.lua
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user