Fix problem with plugin loading

Introduced with PR https://github.com/franko/lite-xl/pull/73
This commit is contained in:
Francesco Abbate 2021-03-05 07:22:56 +01:00
parent bdc473435b
commit 3506ff47fc
1 changed files with 3 additions and 6 deletions

View File

@ -537,12 +537,9 @@ function core.load_plugins()
local no_errors = true
for _, root_dir in ipairs {USERDIR, DATADIR} do
local files = system.list_dir(root_dir .. "/plugins")
for _, plugin_path in ipairs(files or {}) do
local basename = common.basename(plugin_path)
if system.get_file_info(plugin_path).type == "file" then
basename = basename:match("(.-)%.lua$")
end
if basename ~= nil and config[basename] ~= false then
for _, filename in ipairs(files or {}) do
local basename = filename:match("(.-)%.lua$")
if basename and config[basename] ~= false then
local modname = "plugins." .. basename
local ok = core.try(require, modname)
-- Normally a log line is added for each loaded plugin which is a