config: added skip_plugins_version
This new config flag ignores the plugins version check at startup which helps a lot when working on new or old plugins that doesn't match the mod or lite-xl version and you still desire to load them to fix them by checking with lite-xl it self which errors need to be corrected.
This commit is contained in:
parent
e08353ea08
commit
d9909cf4ea
|
@ -29,6 +29,9 @@ config.borderless = false
|
||||||
config.tab_close_button = true
|
config.tab_close_button = true
|
||||||
config.max_clicks = 3
|
config.max_clicks = 3
|
||||||
|
|
||||||
|
-- set as true to be able to test non supported plugins
|
||||||
|
config.skip_plugins_version = false
|
||||||
|
|
||||||
config.plugins = {}
|
config.plugins = {}
|
||||||
-- Allow you to set plugin configs even if we haven't seen the plugin before.
|
-- Allow you to set plugin configs even if we haven't seen the plugin before.
|
||||||
setmetatable(config.plugins, {
|
setmetatable(config.plugins, {
|
||||||
|
|
|
@ -891,12 +891,11 @@ function core.load_plugins()
|
||||||
local plugin_dir, basename = files[filename], filename:match("(.-)%.lua$") or filename
|
local plugin_dir, basename = files[filename], filename:match("(.-)%.lua$") or filename
|
||||||
local is_lua_file, version_match = check_plugin_version(plugin_dir .. '/' .. filename)
|
local is_lua_file, version_match = check_plugin_version(plugin_dir .. '/' .. filename)
|
||||||
if is_lua_file then
|
if is_lua_file then
|
||||||
if not version_match then
|
if not config.skip_plugins_version and not version_match then
|
||||||
core.log_quiet("Version mismatch for plugin %q from %s", basename, plugin_dir)
|
core.log_quiet("Version mismatch for plugin %q from %s", basename, plugin_dir)
|
||||||
local list = refused_list[plugin_dir:find(USERDIR, 1, true) == 1 and 'userdir' or 'datadir'].plugins
|
local list = refused_list[plugin_dir:find(USERDIR, 1, true) == 1 and 'userdir' or 'datadir'].plugins
|
||||||
table.insert(list, filename)
|
table.insert(list, filename)
|
||||||
end
|
elseif config.plugins[basename] ~= false then
|
||||||
if version_match and config.plugins[basename] ~= false then
|
|
||||||
local ok = core.try(require, "plugins." .. basename)
|
local ok = core.try(require, "plugins." .. basename)
|
||||||
if ok then core.log_quiet("Loaded plugin %q from %s", basename, plugin_dir) end
|
if ok then core.log_quiet("Loaded plugin %q from %s", basename, plugin_dir) end
|
||||||
if not ok then
|
if not ok then
|
||||||
|
|
Loading…
Reference in New Issue