diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2024-10-19 16:13:35 -0400 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2024-10-19 16:13:35 -0400 |
commit | 2e703e03284784e721fc23737b2e877f8dfc6b90 (patch) | |
tree | fe23f0b960a4d180143719e52e6fa6608a450858 | |
parent | d050e5c322866e407397955e48824362087b0bb8 (diff) | |
download | lite-xl-plugin-manager-2e703e03284784e721fc23737b2e877f8dfc6b90.tar.gz lite-xl-plugin-manager-2e703e03284784e721fc23737b2e877f8dfc6b90.zip |
Added in small optimization.
-rw-r--r-- | src/lpm.lua | 4 |
1 files changed, 3 insertions, 1 deletions
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 |