From f02e6c65d88ed97df987725853892c1c7a86dc75 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 21 Sep 2025 23:46:09 +0300 Subject: [PATCH] initial fix --- res/layouts/pages/content.xml.lua | 45 +++++++++++++----------- src/logic/scripting/lua/libs/libpack.cpp | 9 ++++- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/res/layouts/pages/content.xml.lua b/res/layouts/pages/content.xml.lua index 8ed37630..611aca63 100644 --- a/res/layouts/pages/content.xml.lua +++ b/res/layouts/pages/content.xml.lua @@ -255,30 +255,33 @@ function check_dependencies(packinfo) if packinfo.dependencies == nil then return end - for i,dep in ipairs(packinfo.dependencies) do + for i, dep in ipairs(packinfo.dependencies) do local depid, depver = unpack(string.split(dep:sub(2,-1), "@")) - if dep:sub(1,1) == '!' then - if not table.has(packs_all, depid) then - return string.format( - "%s (%s)", gui.str("error.dependency-not-found"), depid - ) - end - - - local dep_pack = pack.get_info(depid); - - if not compare_version(depver, dep_pack.version) then - local op, ver = Version.parse(depver); - - print(string.format("%s: %s !%s %s (%s)", gui.str("error.dependency-version-not-met"), dep_pack.version, op, ver, depid)); - return string.format("%s: %s != %s (%s)", gui.str("error.dependency-version-not-met"), dep_pack.version, ver, depid); - end - - if table.has(packs_installed, packinfo.id) then - table.insert(required, depid) - end + if dep:sub(1,1) ~= '!' then + goto continue end + if not table.has(packs_all, depid) then + return string.format( + "%s (%s)", gui.str("error.dependency-not-found"), depid + ) + end + + local dep_pack = pack.get_info(depid); + + if not compare_version(depver, dep_pack.version) then + local op, ver = Version.parse(depver) + return string.format( + "%s: %s != %s (%s)", + gui.str("error.dependency-version-not-met"), + dep_pack.version, ver, depid + ); + end + + if table.has(packs_installed, packinfo.id) then + table.insert(required, depid) + end + ::continue:: end return end diff --git a/src/logic/scripting/lua/libs/libpack.cpp b/src/logic/scripting/lua/libs/libpack.cpp index 29ceef99..f5f952b7 100644 --- a/src/logic/scripting/lua/libs/libpack.cpp +++ b/src/logic/scripting/lua/libs/libpack.cpp @@ -115,7 +115,14 @@ static int l_pack_get_info( throw std::runtime_error(""); } - lua::pushfstring(L, "%s%s@%s%s", prefix.c_str(), dpack.id.c_str(), dpack.op.c_str(), dpack.version.c_str()); + lua::pushfstring( + L, + "%s%s@%s%s", + prefix.c_str(), + dpack.id.c_str(), + dpack.op != "=" ? dpack.op.c_str() : "", + dpack.version.c_str() + ); lua::rawseti(L, i + 1); } lua::setfield(L, "dependencies");