mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-10 04:19:25 -07:00
# Conflicts: # package.json # Conflicts: # .github/workflows/release.yml # README.md # package.json # plugin/subminer/lifecycle.lua # scripts/build-yomitan.mjs # src/core/services/overlay-window.ts # src/main.ts # src/main/overlay-shortcuts-runtime.ts # src/main/runtime/overlay-shortcuts-runtime-main-deps.test.ts # src/main/runtime/overlay-shortcuts-runtime-main-deps.ts # src/window-trackers/base-tracker.ts
31 lines
887 B
Lua
31 lines
887 B
Lua
local mp = require("mp")
|
|
|
|
local function current_script_dir()
|
|
if type(mp.get_script_directory) == "function" then
|
|
local from_mpv = mp.get_script_directory()
|
|
if type(from_mpv) == "string" and from_mpv ~= "" then
|
|
return from_mpv
|
|
end
|
|
end
|
|
|
|
local source = debug.getinfo(1, "S").source or ""
|
|
if source:sub(1, 1) == "@" then
|
|
local full = source:sub(2)
|
|
return full:match("^(.*)[/\\][^/\\]+$") or "."
|
|
end
|
|
return "."
|
|
end
|
|
|
|
local script_dir = current_script_dir()
|
|
local module_patterns = script_dir .. "/?.lua;" .. script_dir .. "/?/init.lua;"
|
|
if not package.path:find(module_patterns, 1, true) then
|
|
package.path = module_patterns .. package.path
|
|
end
|
|
|
|
local init_module = assert(loadfile(script_dir .. "/init.lua"))()
|
|
if type(init_module) == "table" and type(init_module.init) == "function" then
|
|
init_module.init()
|
|
elseif type(init_module) == "function" then
|
|
init_module()
|
|
end
|