aboutsummaryrefslogtreecommitdiff
path: root/lpm.lua
diff options
context:
space:
mode:
authorAdam <adamdharrison@gmail.com>2022-09-16 23:02:27 -0400
committerAdam <adamdharrison@gmail.com>2022-09-16 23:02:27 -0400
commitb1c51396045f49381a802b33986c0026bfb5f33d (patch)
treeb3dfe0fd6aed33e730f534a7434c208990e721e8 /lpm.lua
parentcc0c39b05a783742c10910bb31143e4852126385 (diff)
downloadlite-xl-plugin-manager-b1c51396045f49381a802b33986c0026bfb5f33d.tar.gz
lite-xl-plugin-manager-b1c51396045f49381a802b33986c0026bfb5f33d.zip
Fixed some minor issues.
Diffstat (limited to 'lpm.lua')
-rw-r--r--lpm.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/lpm.lua b/lpm.lua
index 4d2eeac..f08e7d0 100644
--- a/lpm.lua
+++ b/lpm.lua
@@ -512,7 +512,7 @@ function Plugin.new(repository, metadata)
install_path = USERDIR .. PATHSEP .. folder .. PATHSEP .. (metadata.path and common.basename(metadata.path):gsub("%.lua$", "") or metadata.name),
}, metadata), Plugin)
-- Directory.
- self.organization = (self.files or self.remote or not self.path) and "complex" or "singleton"
+ self.organization = ((self.files and #self.files > 0) or self.remote or not self.path) and "complex" or "singleton"
if self.organization == "singleton" then self.install_path = self.install_path .. ".lua" end
local stat = system.stat(self.install_path)
local compatible = (not metadata.mod_version or tonumber(metadata.mod_version) == tonumber(MOD_VERSION))
@@ -603,10 +603,10 @@ local core_plugins = {
}
function Plugin:install(installing)
+ if self.status == "installed" then error("plugin " .. self.name .. " is already installed") end
local status, err = pcall(function()
installing = installing or {}
installing[self.name] = true
- if self.status == "installed" then error("plugin " .. self.name .. " is already installed") end
local compatible, incompatible = self:get_compatibilities()
for plugin, version in pairs(self.dependencies) do
if incompatible[plugin] then error("can't install " .. self.name .. ": incompatible with " .. incompatible[plugin][1].name .. ":" .. incompatible[plugin][1].version) end
@@ -662,7 +662,7 @@ function Plugin:install(installing)
end
end)
if not status then
- common.rmrf(self.local_path)
+ common.rmrf(self.install_path)
error(err)
end
end