aboutsummaryrefslogtreecommitdiff
path: root/src/lpm.lua
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2023-11-30 14:58:40 -0500
committerAdam Harrison <adamdharrison@gmail.com>2023-11-30 14:58:40 -0500
commita64713cef556f994e9db95c2b23e4059917e3219 (patch)
tree752cea8224bc070c37b964843d1ae44dd87d98e6 /src/lpm.lua
parent33eb1611e6b7f0e7f13f0d1a4c3583f8069cd2cb (diff)
downloadlite-xl-plugin-manager-a64713cef556f994e9db95c2b23e4059917e3219.tar.gz
lite-xl-plugin-manager-a64713cef556f994e9db95c2b23e4059917e3219.zip
Added `fetch_if_not_present` to allow things to function without internet.
Diffstat (limited to 'src/lpm.lua')
-rw-r--r--src/lpm.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lpm.lua b/src/lpm.lua
index e8eb844..23ad06d 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -664,7 +664,7 @@ function Addon:unstub()
if not self:is_stub() or self.inaccessible then return end
local repo
local status, err = pcall(function()
- repo = Repository.url(self.remote):fetch()
+ repo = Repository.url(self.remote):fetch_if_not_present()
local manifest = repo:parse_manifest(self.id)
local remote_entry = common.grep(manifest['addons'] or manifest['plugins'], function(e) return e.id == self.id end)[1]
if not remote_entry then error("can't find " .. self.type .. " on " .. self.remote) end
@@ -1142,6 +1142,11 @@ function Repository:generate_manifest(repo_id)
common.write(path .. PATHSEP .. "manifest.json", json.encode({ addons = addons }))
end
+function Repository:fetch_if_not_present()
+ if system.stat(self.local_path) then return end
+ return self:fetch()
+end
+
-- useds to fetch things from a generic place
function Repository:fetch()
if self:is_local() then return self end