diff options
Diffstat (limited to 'plugins/boot.lua')
-rw-r--r-- | plugins/boot.lua | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/plugins/boot.lua b/plugins/boot.lua index 858e1a5b4db..390ce652ff6 100644 --- a/plugins/boot.lua +++ b/plugins/boot.lua @@ -2,29 +2,13 @@ -- copyright-holders:Miodrag Milanovic require('lfs') --- add helper to lfs for plugins to use -function lfs.env_replace(str) - local pathsep = package.config:sub(1,1) - local function dorep(val) - ret = os.getenv(val) - if ret then - return ret - end - return val - end - - if pathsep == '\\' then - str = str:gsub("%%(%w+)%%", dorep) - else - str = str:gsub("%$(%w+)", dorep) - end - return str -end - _G._ = emu.lang_translate - +_G._p = emu.lang_translate +_G.N_ = function (message) return message end +_G.N_p = function (context, message) return message end +_G.emu.plugin = {} -- table to contain plugin interfaces -- substitute environment variables in the plugins path from options -local dirs = lfs.env_replace(manager:options().entries.pluginspath:value()) +local dirs = manager.options.entries.pluginspath:value() -- and split the paths apart and make them suitable for package.path package.path = "" @@ -35,7 +19,7 @@ for dir in string.gmatch(dirs, "([^;]+)") do package.path = package.path .. dir .. "/?.lua;" .. dir .. "/?/init.lua" end -for _,entry in pairs(manager:plugins()) do +for _,entry in pairs(manager.plugins) do if (entry.type == "plugin" and entry.start) then emu.print_verbose("Starting plugin " .. entry.name .. "...") plugin = require(entry.name) |