diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2024-10-19 16:57:59 -0400 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2024-10-19 16:57:59 -0400 |
commit | 045d9290da7f3c19e155b8f51b6d03cbd374e43e (patch) | |
tree | afa7746386cb16915da67a964c0b26c643f7bb8a | |
parent | 39a8632d26af03e824a165ca4ad4071a972392be (diff) | |
download | lite-xl-plugin-manager-045d9290da7f3c19e155b8f51b6d03cbd374e43e.tar.gz lite-xl-plugin-manager-045d9290da7f3c19e155b8f51b6d03cbd374e43e.zip |
Properly determined mod_version of lite-xl.
-rw-r--r-- | src/lpm.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lpm.lua b/src/lpm.lua index c8f3199..9c94bc9 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -1807,7 +1807,7 @@ function lpm.lite_xl_add(version, path) local path_stat = assert(system.stat(path:gsub(PATHSEP .. "$", "")), "can't find lite-xl path " .. path) local mod_version = MOD_VERSION if mod_version == "any" or not mod_version then - mod_version = common.read(data_path .. PATHSEP .. "start.lua"):match("MOD_VERSION_MAJOR%s=%s(%d+)") + mod_version = common.read(data_path .. PATHSEP .. "core" .. PATHSEP .. "start.lua"):match("MOD_VERSION_MAJOR%s=%s(%d+)") 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() @@ -2270,14 +2270,16 @@ function lpm.setup() if not BINARY and not DATADIR and system_lite_xl then error("can't find existing system lite (does " .. system_lite_xl:get_binary_path() .. " exist? was it moved?); run `lpm purge`, or specify --binary and --datadir.") end local mod_version = MOD_VERSION - if mod_version == "any" or not mod_version then - mod_version = common.read(DATADIR .. PATHSEP .. "start.lua"):match("MOD_VERSION_MAJOR%s=%s(%d+)") + if lite_xl_datadir and (mod_version == "any" or not mod_version) then + local path = lite_xl_datadir .. PATHSEP .. "core" .. PATHSEP .. "start.lua" + if system.stat(path) then + mod_version = common.read(path):match("MOD_VERSION_MAJOR%s=%s(%d+)") + end end - local detected_lite_xl = LiteXL.new(nil, { path = directory, datadir_path = lite_xl_datadir, binary_path = { [DEFAULT_ARCH] = lite_xl_binary }, mod_version = MOD_VERSION or LATEST_MOD_VERSION, version = "system", tags = { "system", "local" } }) + local detected_lite_xl = LiteXL.new(nil, { path = directory, datadir_path = lite_xl_datadir, binary_path = { [DEFAULT_ARCH] = lite_xl_binary }, mod_version = mod_version or LATEST_MOD_VERSION, version = "system", tags = { "system", "local" } }) if not system_lite_xl then system_lite_xl = detected_lite_xl table.insert(lite_xls, system_lite_xl) - lpm.lite_xl_save() else lite_xls = common.grep(lite_xls, function(e) return e ~= system_lite_xl end) system_lite_xl = detected_lite_xl |