make user plugin take precedence over system plugins (#244)
This commit is contained in:
parent
a3e04a209c
commit
864180e408
|
@ -714,10 +714,15 @@ function core.load_plugins()
|
||||||
userdir = {dir = USERDIR, plugins = {}},
|
userdir = {dir = USERDIR, plugins = {}},
|
||||||
datadir = {dir = DATADIR, plugins = {}},
|
datadir = {dir = DATADIR, plugins = {}},
|
||||||
}
|
}
|
||||||
for _, root_dir in ipairs {USERDIR, DATADIR} do
|
local files = {}
|
||||||
|
for _, root_dir in ipairs {DATADIR, USERDIR} do
|
||||||
local plugin_dir = root_dir .. "/plugins"
|
local plugin_dir = root_dir .. "/plugins"
|
||||||
local files = system.list_dir(plugin_dir)
|
for _, filename in ipairs(system.list_dir(plugin_dir) or {}) do
|
||||||
for _, filename in ipairs(files or {}) do
|
files[filename] = plugin_dir -- user plugins will always replace system plugins
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for filename, plugin_dir in pairs(files) do
|
||||||
local basename = filename:match("(.-)%.lua$") or filename
|
local basename = filename:match("(.-)%.lua$") or filename
|
||||||
local version_match = check_plugin_version(plugin_dir .. '/' .. filename)
|
local version_match = check_plugin_version(plugin_dir .. '/' .. filename)
|
||||||
if not version_match then
|
if not version_match then
|
||||||
|
@ -734,7 +739,6 @@ function core.load_plugins()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
return no_errors, refused_list
|
return no_errors, refused_list
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue