parent
8567f6a7ee
commit
7f50df6a2f
|
@ -546,17 +546,14 @@ end
|
||||||
function core.load_plugins()
|
function core.load_plugins()
|
||||||
local no_errors = true
|
local no_errors = true
|
||||||
for _, root_dir in ipairs {USERDIR, DATADIR} do
|
for _, root_dir in ipairs {USERDIR, DATADIR} do
|
||||||
local files = system.list_dir(root_dir .. "/plugins")
|
local plugin_dir = root_dir .. "/plugins"
|
||||||
|
local files = system.list_dir(plugin_dir)
|
||||||
for _, filename in ipairs(files or {}) do
|
for _, filename in ipairs(files or {}) do
|
||||||
local basename = filename:match("(.-)%.lua$")
|
local basename = filename:match("(.-)%.lua$") or filename
|
||||||
if basename and config[basename] ~= false then
|
if config[basename] ~= false then
|
||||||
local modname = "plugins." .. basename
|
local modname = "plugins." .. basename
|
||||||
local ok = core.try(require, modname)
|
local ok = core.try(require, modname)
|
||||||
-- Normally a log line is added for each loaded plugin which is a
|
if ok then core.log_quiet("Loaded plugin %q from %s", basename, plugin_dir) end
|
||||||
-- good thing. Unfortunately we load the user module before the plugins
|
|
||||||
-- so all the messages here can fill the log screen and hide an eventual
|
|
||||||
-- user module's error.
|
|
||||||
-- if ok then core.log_quiet("Loaded plugin %q", modname) end
|
|
||||||
if not ok then
|
if not ok then
|
||||||
no_errors = false
|
no_errors = false
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue