aboutsummaryrefslogtreecommitdiff
path: root/plugins/plugin_manager/init.lua
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2024-04-25 11:30:53 -0400
committerAdam Harrison <adamdharrison@gmail.com>2024-04-25 11:30:53 -0400
commit74e64f6f2c3b5917e0008e7a371539ab3ca653bf (patch)
tree5cf664c90f1705981173415c9841f84cd6511461 /plugins/plugin_manager/init.lua
parent86e248270509d5772286fa9ae245e1fc097e9401 (diff)
downloadlite-xl-plugin-manager-74e64f6f2c3b5917e0008e7a371539ab3ca653bf.tar.gz
lite-xl-plugin-manager-74e64f6f2c3b5917e0008e7a371539ab3ca653bf.zip
Fixed up a few things.
Diffstat (limited to 'plugins/plugin_manager/init.lua')
-rw-r--r--plugins/plugin_manager/init.lua17
1 files changed, 10 insertions, 7 deletions
diff --git a/plugins/plugin_manager/init.lua b/plugins/plugin_manager/init.lua
index 655c156..3f703cf 100644
--- a/plugins/plugin_manager/init.lua
+++ b/plugins/plugin_manager/init.lua
@@ -268,7 +268,7 @@ PluginManager.view = require "plugins.plugin_manager.plugin_view"
if config.plugins.plugin_manager.addons then
- local target_plugin_directory = USERDIR .. PATHSEP .. "projects" .. PATHSEP .. common.basename(system.absolute_path("."))
+ local target_plugin_directory = config.plugins.plugin_manger.adddon_directory or (USERDIR .. PATHSEP .. "projects" .. PATHSEP .. common.basename(system.absolute_path(".")))
local mod_version_regex =
regex.compile([[--.*mod-version:(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:$|\s)]])
@@ -427,6 +427,7 @@ if config.plugins.plugin_manager.addons then
end
local addons = {}
+ local added_addons = {}
for i,v in ipairs(config.plugins.plugin_manager.addons) do
if type(v) == 'table' then
local string = ""
@@ -441,23 +442,25 @@ if config.plugins.plugin_manager.addons then
string = string .. v.id
if v.version then string = string .. ":" .. v.version end
table.insert(addons, string)
+ added_addons[v.id] = true
else
table.insert(addons, v)
+ added_addons[v] = true
end
end
local plugins = system.list_dir(USERDIR .. PATHSEP .. "plugins")
+ run({ "apply", table.unpack(addons), }, { userdir = target_plugin_directory, cachedir = USERDIR .. PATHSEP .. "lpm" }):done(function(status)
+ if json.decode(status)["changed"] then command.perform("core:restart") end
+ end)
+ lpm_load_plugins()
local old_configs = {}
for i,v in ipairs(plugins or {}) do
- local id = v:gsub("%.lua", "")
- if config.plugins[id] ~= false and id ~= "plugin_manager" then
+ local id = v:gsub("%.lua$", "")
+ if config.plugins[id] ~= false and id ~= "plugin_manager" and not added_addons[id] then
old_configs[id] = config.plugins[id]
config.plugins[id] = false
end
end
- run({ "apply", table.unpack(addons), }, { userdir = target_plugin_directory, cachedir = USERDIR .. PATHSEP .. "lpm" }):done(function(status)
- if json.decode(status)["changed"] then command.perform("core:restart") end
- end)
- lpm_load_plugins()
end