mirror of
https://github.com/holub/mame
synced 2025-07-05 18:08:04 +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
|
-- license:BSD-3-Clause
|
||||||
-- copyright-holders:Miodrag Milanovic
|
-- copyright-holders:Miodrag Milanovic
|
||||||
require('lfs')
|
require('lfs')
|
||||||
local cwd = lfs.currentdir()
|
local dir = manager:options().entries.pluginspath:value()
|
||||||
package.path = cwd .. "/plugins/?.lua;" .. cwd .. "/plugins/?/init.lua"
|
package.path = dir .. "/?.lua;" .. dir .. "/?/init.lua"
|
||||||
|
|
||||||
local json = require('json')
|
local json = require('json')
|
||||||
function readAll(file)
|
function readAll(file)
|
||||||
@ -12,16 +12,16 @@ function readAll(file)
|
|||||||
return content
|
return content
|
||||||
end
|
end
|
||||||
|
|
||||||
for file in lfs.dir("plugins") do
|
for file in lfs.dir(dir) do
|
||||||
if (file~="." and file~=".." and lfs.attributes("plugins/" .. file,"mode")=="directory") then
|
if (file~="." and file~=".." and lfs.attributes(dir .. "/" .. file,"mode")=="directory") then
|
||||||
local filename = "plugins/" .. file .. "/plugin.json"
|
local filename = dir .. "/" .. file .. "/plugin.json"
|
||||||
local meta = json.parse(readAll(filename))
|
local meta = json.parse(readAll(filename))
|
||||||
if (meta["plugin"]["type"]=="plugin") and (mame_manager:plugins().entries[meta["plugin"]["name"]]~=nil) then
|
if (meta["plugin"]["type"]=="plugin") and (mame_manager:plugins().entries[meta["plugin"]["name"]]~=nil) then
|
||||||
local entry = mame_manager:plugins().entries[meta["plugin"]["name"]]
|
local entry = mame_manager:plugins().entries[meta["plugin"]["name"]]
|
||||||
if (entry:value()==true) then
|
if (entry:value()==true) then
|
||||||
emu.print_verbose("Starting plugin " .. meta["plugin"]["name"] .. "...")
|
emu.print_verbose("Starting plugin " .. meta["plugin"]["name"] .. "...")
|
||||||
plugin = require(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();
|
plugin.startplugin();
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user