aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2023-01-17 20:10:57 -0500
committerAdam Harrison <adamdharrison@gmail.com>2023-01-17 20:10:57 -0500
commit02fea1ede8878fb2fa7b4708e11ef28b0b375152 (patch)
treebe336052cd27b3ac8963370c054fa4cf8e5a3a6c
parenta8d1b8a63556690cecef373670b22c50ba215ec0 (diff)
downloadlite-xl-plugin-manager-0.9997.tar.gz
lite-xl-plugin-manager-0.9997.zip
Changed complexity of plugins that supply an init.lua.v0.9997
-rw-r--r--src/lpm.lua5
-rw-r--r--t/run.lua2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/lpm.lua b/src/lpm.lua
index 5572f98..2467b55 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -913,11 +913,12 @@ function Repository:generate_manifest(repo_id)
local files = folder == "plugins" and system.stat(path .. PATHSEP .. "init.lua") and { "init.lua" } or system.ls(path .. addon_dir)
for i, file in ipairs(files) do
if file:find("%.lua$") then
- local name = common.basename(file):gsub("%.lua$", "")
+ local filename = common.basename(file):gsub("%.lua$", "")
+ local name = filename
if repo_id and name == "init" then name = repo_id end
if name ~= "init" then
local type = folder == "colors" and "color" or (folder == "libraries" and "library" or "plugin")
- local addon = { description = nil, id = name:lower():gsub("[^a-z0-9%-_]", ""), name = name, mod_version = 3, version = "0.1", path = addon_dir .. file, type = type }
+ local addon = { description = nil, id = name:lower():gsub("[^a-z0-9%-_]", ""), name = name, mod_version = 3, version = "0.1", path = (filename ~= "init" and (addon_dir .. file) or nil), type = type }
for line in io.lines(path .. addon_dir .. PATHSEP .. file) do
local _, _, mod_version = line:find("%-%-.*mod%-version:%s*(%w+)")
if mod_version then addon.mod_version = mod_version end
diff --git a/t/run.lua b/t/run.lua
index 0409d71..c3babcf 100644
--- a/t/run.lua
+++ b/t/run.lua
@@ -33,7 +33,7 @@ local tests = {
plugins = lpm("list bracketmatch")["addons"]
assert(#plugins == 1)
lpm("install console")
- assert_exists(userdir .. "/plugins/console.lua")
+ assert_exists(userdir .. "/plugins/console/init.lua")
end,
["02_install_complex"] = function()
local plugins = lpm("list plugin_manager")["addons"]