From 2e703e03284784e721fc23737b2e877f8dfc6b90 Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sat, 19 Oct 2024 16:13:35 -0400 Subject: Added in small optimization. --- src/lpm.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/lpm.lua') diff --git a/src/lpm.lua b/src/lpm.lua index 9241a23..4b211f8 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -826,9 +826,10 @@ function Addon:get_path(bottle) end function Addon:get_compatibilities(bottle) + local dependency_list = common.canonical_order(self.dependencies) + if #dependency_list == 0 then return {}, {} end local compatible_addons, incompatible_addons = {}, {} local installed_addons = bottle:installed_addons() - local dependency_list = common.canonical_order(self.dependencies) for _, addon in ipairs(dependency_list) do local v = self.dependencies[addon] local potential_addons = { bottle:get_addon(addon, v.version, MOD_VERSION ~= "any" and { mod_version = bottle.lite_xl.mod_version }) } @@ -861,6 +862,7 @@ function Addon:install(bottle, installing) local install_path = self:get_install_path(bottle) if install_path:find(USERDIR, 1, true) ~= 1 and install_path:find(TMPDIR, 1, true) ~= 1 then error("invalid install path: " .. install_path) end local temporary_install_path = TMPDIR .. PATHSEP .. install_path:sub(((install_path:find(TMPDIR, 1, true) == 1) and #TMPDIR or #USERDIR) + 2) + local status, err = pcall(function() installing = installing or {} installing[self.id] = true -- cgit v1.2.3