diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2023-03-19 13:20:50 -0400 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2023-03-19 13:20:50 -0400 |
commit | 1da290c19ddfedcb52be24de5a3eee1b2e23c24b (patch) | |
tree | 4e3d807a61185a44304227e1e46e74bf1fca484b | |
parent | 650910b43ab0d8c132472d3e8f57d867fe3bfb30 (diff) | |
download | lite-xl-plugin-manager-1.0.tar.gz lite-xl-plugin-manager-1.0.zip |
Fixed running bottles. We're good to go.v1.0
-rw-r--r-- | src/lpm.lua | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/lpm.lua b/src/lpm.lua index 5004ead..901067b 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -1208,9 +1208,14 @@ function Bottle:construct() if not self.lite_xl:is_installed() then self.lite_xl:install() end common.mkdirp(self.local_path .. PATHSEP .. "user") + -- Always copy the executbale, because of the way that lite determines the user folder (for now). common.copy(self.lite_xl:get_binary_path(), self.local_path .. PATHSEP .. "lite-xl" .. EXECUTABLE_EXTENSION) - system.chmod(self.local_path .. PATHSEP .. "lite-xl" .. EXECUTABLE_EXTENSION, 448) -- chmod to rwx------- - common.copy(self.lite_xl.datadir_path, self.local_path .. PATHSEP .. "data") + system.chmod(self.local_path .. PATHSEP .. "lite-xl" .. EXECUTABLE_EXTENSION, 448) -- chmod to rwx-------\ + if SYMLINK then + system.symlink(self.lite_xl.datadir_path, self.local_path .. PATHSEP .. "data") + else + common.copy(self.lite_xl.datadir_path, self.local_path .. PATHSEP .. "data") + end for i,addon in ipairs(self.addons) do addon:install(self) end end @@ -1223,7 +1228,7 @@ end function Bottle:run(args) args = args or {} if self.is_system then error("system bottle cannot be run") end - os.execute(self.local_path .. PATHSEP .. "lite-xl", table.unpack(args)) + os.execute(self.local_path .. PATHSEP .. "lite-xl" .. (#args > 0 and " " or "") .. table.concat(args, " ")) end local function get_repository_addons() @@ -1530,7 +1535,8 @@ local function lpm_lite_xl_run(version, ...) local addons = {} local arguments = { ... } local i = 1 - while i <= #arguments and arguments[i] ~= "--" do + while i <= #arguments do + if arguments[i] == "--" then break end local str = arguments[i] local id, version = common.split(":", str) local addon = system_bottle:get_addon(id, version, { mod_version = lite_xl.mod_version }) @@ -1662,6 +1668,10 @@ local function lpm_addon_upgrade() end end +local function lpm_bottle_purge() + common.rmrf(CACHEDIR .. PATHSEP .. "bottles") +end + local function lpm_purge() log_action("Removed " .. CACHEDIR .. ".") common.rmrf(CACHEDIR) @@ -1727,6 +1737,7 @@ local function run_command(ARGS) elseif ARGS[2] == "lite-xl" and ARGS[3] == "run" then return lpm_lite_xl_run(table.unpack(common.slice(ARGS, 4))) elseif ARGS[2] == "lite-xl" and ARGS[3] == "add" then return lpm_lite_xl_add(table.unpack(common.slice(ARGS, 4))) elseif ARGS[2] == "lite-xl" and ARGS[3] == "rm" then return lpm_lite_xl_rm(table.unpack(common.slice(ARGS, 4))) + elseif ARGS[2] == "bottle" and ARGS[3] == "purge" then return lpm_bottle_purge(common.slice(ARGS, 4)) elseif ARGS[2] == "run" then return lpm_lite_xl_run(table.unpack(common.slice(ARGS, 3))) elseif ARGS[2] == "switch" then return lpm_lite_xl_switch(table.unpack(common.slice(ARGS, 3))) elseif ARGS[2] == "purge" then lpm_purge() |