mirror of
https://github.com/holub/mame
synced 2025-04-16 13:34:55 +03:00
boot.lua: make pluginspath apply here too (nw)
This commit is contained in:
parent
6f07f5c299
commit
0522e44d2f
@ -1,8 +1,8 @@
|
||||
-- license:BSD-3-Clause
|
||||
-- copyright-holders:Miodrag Milanovic
|
||||
require('lfs')
|
||||
local cwd = lfs.currentdir()
|
||||
package.path = cwd .. "/plugins/?.lua;" .. cwd .. "/plugins/?/init.lua"
|
||||
local dir = manager:options().entries.pluginspath:value()
|
||||
package.path = dir .. "/?.lua;" .. dir .. "/?/init.lua"
|
||||
|
||||
local json = require('json')
|
||||
function readAll(file)
|
||||
@ -12,16 +12,16 @@ function readAll(file)
|
||||
return content
|
||||
end
|
||||
|
||||
for file in lfs.dir("plugins") do
|
||||
if (file~="." and file~=".." and lfs.attributes("plugins/" .. file,"mode")=="directory") then
|
||||
local filename = "plugins/" .. file .. "/plugin.json"
|
||||
for file in lfs.dir(dir) do
|
||||
if (file~="." and file~=".." and lfs.attributes(dir .. "/" .. file,"mode")=="directory") then
|
||||
local filename = dir .. "/" .. file .. "/plugin.json"
|
||||
local meta = json.parse(readAll(filename))
|
||||
if (meta["plugin"]["type"]=="plugin") and (mame_manager:plugins().entries[meta["plugin"]["name"]]~=nil) then
|
||||
local entry = mame_manager:plugins().entries[meta["plugin"]["name"]]
|
||||
if (entry:value()==true) then
|
||||
emu.print_verbose("Starting plugin " .. meta["plugin"]["name"] .. "...")
|
||||
plugin = require(meta["plugin"]["name"])
|
||||
if plugin.set_folder~=nil then plugin.set_folder("plugins/" .. file) end
|
||||
if plugin.set_folder~=nil then plugin.set_folder(dir .. "/" .. file) end
|
||||
plugin.startplugin();
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user