aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2024-02-06 21:54:08 -0500
committerAdam Harrison <adamdharrison@gmail.com>2024-02-06 21:54:08 -0500
commit8a1e790b38013ccc0da5f754c0c82ce50f2a3e57 (patch)
tree452b829a178eed35a7a7ee80e427a0c082c92a53
parentf8378d3ca44c93e14dfc16ce5f035446c75d657d (diff)
downloadlite-xl-plugin-manager-8a1e790b38013ccc0da5f754c0c82ce50f2a3e57.tar.gz
lite-xl-plugin-manager-8a1e790b38013ccc0da5f754c0c82ce50f2a3e57.zip
Made paths absolute when adding a lite-xl.
-rw-r--r--src/lpm.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lpm.lua b/src/lpm.lua
index 079bc40..fdad689 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -1610,9 +1610,12 @@ local function lpm_lite_xl_add(version, path)
if common.first(lite_xls, function(lite_xl) return lite_xl.version == version end) then error(version .. " lite-xl already exists") end
local binary_path = BINARY or (path and(path .. PATHSEP .. "lite-xl" .. EXECUTABLE_EXTENSION))
local data_path = DATADIR or (path and (path .. PATHSEP .. "data"))
- if not system.stat(binary_path) then error("can't find " .. binary_path) end
- if not system.stat(data_path) then error("can't find " .. data_path) end
- table.insert(lite_xls, LiteXL.new(nil, { version = version, binary_path = { [ARCH[1]] = binary_path }, datadir_path = data_path, path = path:gsub(PATHSEP .. "$", ""), mod_version = MOD_VERSION or LATEST_MOD_VERSION }))
+ local binary_stat, data_stat = system.stat(binary_path), system.stat(data_path)
+ if not binary_stat then error("can't find " .. binary_path) end
+ if not data_stat then error("can't find " .. data_path) end
+ local path_stat = system.stat(path:gsub(PATHSEP .. "$", ""))
+ if not path_stat then error("can't find " .. path) end
+ table.insert(lite_xls, LiteXL.new(nil, { version = version, binary_path = { [ARCH[1]] = binary_stat.abs_path }, datadir_path = data_stat.abs_path, path = path_stat.abs_path, mod_version = MOD_VERSION or LATEST_MOD_VERSION }))
lpm_lite_xl_save()
end