aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2024-05-13 16:44:03 -0400
committerAdam Harrison <adamdharrison@gmail.com>2024-05-13 16:44:03 -0400
commit0d153a3148382242ae2a71511664bb1a106b6fc5 (patch)
treeaf5040413add6dd5b85cdc7ed4a7dcf147dd0951
parent7f5933f02ab229cabb1ad2bb1a900ef2a9165ed3 (diff)
downloadlite-xl-plugin-manager-0d153a3148382242ae2a71511664bb1a106b6fc5.tar.gz
lite-xl-plugin-manager-0d153a3148382242ae2a71511664bb1a106b6fc5.zip
Fix for issue #112.
-rw-r--r--src/lpm.lua34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/lpm.lua b/src/lpm.lua
index e981d0d..2e3772b 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -539,6 +539,15 @@ global({
global({ "HOME", "USERDIR", "CACHEDIR", "JSON", "TABLE", "HEADER", "RAW", "VERBOSE", "FILTRATION", "MOD_VERSION", "QUIET", "FORCE", "REINSTALL", "CONFIG", "NO_COLOR", "AUTO_PULL_REMOTES", "ARCH", "ASSUME_YES", "NO_INSTALL_OPTIONAL", "TMPDIR", "DATADIR", "BINARY", "POST", "PROGRESS", "SYMLINK", "REPOSITORY", "EPHEMERAL", "MASK", "settings", "repositories", "lite_xls", "system_bottle", "progress_bar_label", "write_progress_bar" })
global({ Addon = {}, Repository = {}, LiteXL = {}, Bottle = {}, lpm = {}, log = {} })
+-- in the cases where we don't have a manifest, assume generalized structure, take addons folder, trawl through it, build manifest that way
+-- assuming each .lua file under the `addons` folder is a addon. also parse the README, if present, and see if any of the addons
+-- Ignore any requries that are in CORE_PLUGINS.
+local CORE_PLUGINS = {
+ autocomplete = true, autoreload = true, contextmenu = true, detectindent = true, drawwhitespace = true, language_c = true, language_cpp = true, language_css = true, language_dart = true,
+ language_html = true, language_js = true, language_lua = true, language_md = true, language_python = true, language_xml = true, lineguide = true, linewrapping = true, macro = true,
+ projectsearch = true, quote = true, reflow = true, scale = true, tabularize = true, toolbarview = true, treeview = true, trimwhitespace = true, workspace = true
+}
+
local function engage_locks(func, err, warn)
if not system.stat(CACHEDIR) then common.mkdirp(CACHEDIR) end
local lockfile = CACHEDIR .. PATHSEP .. ".lock"
@@ -1139,14 +1148,6 @@ function Repository:parse_manifest(repo_id)
end
--- in the cases where we don't have a manifest, assume generalized structure, take addons folder, trawl through it, build manifest that way
--- assuming each .lua file under the `addons` folder is a addon. also parse the README, if present, and see if any of the addons
--- Ignore any requries that are in CORE_PLUGINS.
-local CORE_PLUGINS = {
- autocomplete = true, autoreload = true, contextmenu = true, detectindent = true, drawwhitespace = true, language_c = true, language_cpp = true, language_css = true, language_dart = true,
- language_html = true, language_js = true, language_lua = true, language_md = true, language_python = true, language_xml = true, lineguide = true, linewrapping = true, macro = true,
- projectsearch = true, quote = true, reflow = true, scale = true, tabularize = true, toolbarview = true, treeview = true, trimwhitespace = true, workspace = true
-}
function Repository:generate_manifest(repo_id)
if not self.local_path and not self.commit and not self.branch then error("requires an instantiation") end
local path = self.local_path
@@ -1592,11 +1593,28 @@ function Bottle:all_addons()
description = (hash[id] and hash[id][1].description or nil),
repo_path = (hash[id] and hash[id][1].local_path or nil)
}))
+ if not hash[id] then hash[id] = t[#t] end
end
end
end
end
end
+ -- If we can't find the datadir, assume that we have the core plugins installed.
+ if not system.stat(self.lite_xl.datadir_path) then
+ for id, v in pairs(CORE_PLUGINS) do
+ if not hash[id] then
+ table.insert(t, Addon.new(nil, {
+ id = id,
+ type = "plugin",
+ location = "core",
+ organization = "singleton",
+ local_path = nil,
+ mod_version = self.lite_xl.mod_version,
+ path = "plugins" .. PATHSEP .. id .. ".lua"
+ }))
+ end
+ end
+ end
self.all_addons_cache = t
return t
end