mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
properly load all plugins to lua package path
This commit is contained in:
parent
87259f96cb
commit
12fa725505
8 changed files with 56 additions and 94 deletions
|
|
@ -1,5 +1,4 @@
|
|||
local env_conf = os.getenv("XDG_CONFIG_HOME")
|
||||
|
||||
if not env_conf then
|
||||
env_conf = os.getenv("HOME")
|
||||
if not env_conf then
|
||||
|
|
@ -8,13 +7,31 @@ if not env_conf then
|
|||
env_conf = mez.fs.joinpath(env_conf, ".config")
|
||||
end
|
||||
|
||||
local env_data = os.getenv("XDG_DATA_HOME")
|
||||
if not env_data then
|
||||
env_data = os.getenv("HOME")
|
||||
if not env_data then
|
||||
error("Couldn't determine potential data directory is $HOME set?")
|
||||
end
|
||||
|
||||
env_data = mez.fs.joinpath(env_data, ".local", "share", "mez")
|
||||
end
|
||||
|
||||
-- allow plugin loading in .local/share/mez/plugins
|
||||
local plugin_dir = mez.fs.joinpath(env_data, "plugins")
|
||||
|
||||
for _, plugin_name in ipairs(mez.fs.subdirs(plugin_dir)) do
|
||||
package.path = package.path .. ";" .. mez.fs.joinpath(plugin_dir, plugin_name, "lua", "?", "init.lua")
|
||||
package.path = package.path .. ";" .. mez.fs.joinpath(plugin_dir, plugin_name, "lua", "?.lua")
|
||||
end
|
||||
|
||||
-- allow loading files in the runtime directory
|
||||
package.path = package.path..";"..mez.fs.joinpath(mez.path.runtime, "?.lua")
|
||||
package.path = package.path .. ";" .. mez.fs.joinpath(mez.path.runtime, "?.lua")
|
||||
mez.inspect = require("inspect").inspect
|
||||
|
||||
mez.path.base_config = mez.fs.joinpath(mez.path.runtime, "master.lua")
|
||||
mez.path.base_config = mez.fs.joinpath(mez.path.runtime, "base_config.lua")
|
||||
|
||||
if not mez.path.config then
|
||||
mez.path.config = mez.fs.joinpath(env_conf, "mez", "init.lua")
|
||||
package.path = package.path..";"..mez.fs.joinpath(env_conf, "mez", "lua", "?.lua")
|
||||
package.path = package.path .. ";" .. mez.fs.joinpath(env_conf, "mez", "lua", "?.lua")
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue