FileManager: don't load already loaded plugins (#6958)

FileManager:init is called by FileManager:reinit, which caused duplicate
loads. Those can't be useful, (for example to re-load a modified plugin
on runtime), as PluginLoader:loadPlugins memoizes loaded plugins.
reviewable/pr6960/r1
jperon 3 years ago committed by GitHub
parent c20ad8f5e9
commit 53a7067c24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -479,19 +479,22 @@ function FileManager:init()
table.insert(self, DeviceListener:new{ ui = self })
-- koreader plugins
for _,plugin_module in ipairs(PluginLoader:loadPlugins()) do
if not plugin_module.is_doc_only then
local ok, plugin_or_err = PluginLoader:createPluginInstance(
plugin_module, { ui = self, })
-- Keep references to the modules which do not register into menu.
if ok then
local name = plugin_module.name
if name then self[name] = plugin_or_err end
table.insert(self, plugin_or_err)
logger.info("FM loaded plugin", name,
"at", plugin_module.path)
if not self._plugins_loaded then
for _,plugin_module in ipairs(PluginLoader:loadPlugins()) do
if not plugin_module.is_doc_only then
local ok, plugin_or_err = PluginLoader:createPluginInstance(
plugin_module, { ui = self, })
-- Keep references to the modules which do not register into menu.
if ok then
local name = plugin_module.name
if name then self[name] = plugin_or_err end
table.insert(self, plugin_or_err)
logger.info("FM loaded plugin", name,
"at", plugin_module.path)
end
end
end
self._plugins_loaded = true
end
if Device:hasWifiToggle() then

Loading…
Cancel
Save