From 8a1e790b38013ccc0da5f754c0c82ce50f2a3e57 Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Tue, 6 Feb 2024 21:54:08 -0500 Subject: Made paths absolute when adding a lite-xl. --- src/lpm.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/lpm.lua') 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 -- cgit v1.2.3