diff options
author | Adam <adamdharrison@gmail.com> | 2022-09-29 21:31:25 -0400 |
---|---|---|
committer | Adam <adamdharrison@gmail.com> | 2022-09-29 21:31:25 -0400 |
commit | 398e1799e8fbcaae11d2ff9a084a94cbb26a4ff6 (patch) | |
tree | 55ffc8baddda9d22afbaf6e08fa33465c68a2c66 /lpm.lua | |
parent | cc5c601b6ba8d65ffb411f6ea5bc47a5ea0b88b7 (diff) | |
download | lite-xl-plugin-manager-398e1799e8fbcaae11d2ff9a084a94cbb26a4ff6.tar.gz lite-xl-plugin-manager-398e1799e8fbcaae11d2ff9a084a94cbb26a4ff6.zip |
Attempting to fix..
Diffstat (limited to 'lpm.lua')
-rw-r--r-- | lpm.lua | 31 |
1 files changed, 22 insertions, 9 deletions
@@ -356,6 +356,25 @@ end local common = {} + +function common.split(splitter, str) + local o = 1 + local res = {} + while true do + local s, e = str:find(splitter, o) + table.insert(res, str:sub(o, s and (s - 1) or #str)) + if not s then break end + o = e + 1 + end + return table.unpack(res) +end + +function common.dirname(path) + local s = path:reverse():find(PATHSEP) + if not s then return path end + return path:sub(1, #path - s) +end + function common.rmrf(root) if not root or root == "" then return end local info = system.stat(root) @@ -369,9 +388,9 @@ function common.mkdirp(path) local stat = system.stat(path) if stat and stat.type == "dir" then return true end if stat and stat.type == "file" then error("path " .. path .. " exists") end + system.mkdir(path) local subdirs = {} while path and path ~= "" do - system.mkdir(path) local updir, basedir = path:match("(.*)[/\\](.+)$") table.insert(subdirs, 1, basedir or path) path = updir @@ -390,12 +409,6 @@ function common.basename(path) end -function common.dirname(path) - local s = path:reverse():find(PATHSEP) - if not s then return path end - return path:sub(1, #path - s) -end - function common.merge(src, merge) for k, v in pairs(merge) do src[k] = v end @@ -1241,9 +1254,9 @@ local function lpm_plugin_uninstall(...) for i, name in ipairs({ ... }) do local plugins = { get_plugin(name) } if #plugins == 0 then error("can't find plugin " .. name) end - local installed_plugins = common.grep(plugins, function(plugin) return plugin:is_installed() end) + local installed_plugins = common.grep(plugins, function(plugin) return plugin:is_installed(system_bottle) end) if #installed_plugins == 0 then error("plugin " .. name .. " not installed") end - for i, plugin in ipairs(installed_plugins) do plugin:uninstall() end + for i, plugin in ipairs(installed_plugins) do plugin:uninstall(system_bottle) end end end |