Files
gen1recomp/tests/engine/launcher_nx_version_chip_test.lua
T
Andrew Quenehen ae5276b2d1 Show the running app version on the Switch launcher header.
Add an NX-only yellow version chip so players can confirm which build is on the microSD after OTA or zip updates.
2026-08-05 02:08:20 -03:00

27 lines
1.0 KiB
Lua

-- Switch launcher shows the running engine version in the header (NX only).
-- Desktop/Android/iOS must not paint that chip.
local function read(path)
local f = assert(io.open(path, "r"))
local s = f:read("*a")
f:close()
return s
end
local src = read("src/import/LauncherView.lua")
assert(src:find('local Version = require%("src%.core%.Version"%)')
or src:find('require%("src%.core%.Version"%)'),
"LauncherView must require Version")
assert(src:find("imp%.isNX", 1, false), "version chip must gate on isNX")
-- The chip is inside an isNX block and prints Version.engine
local nxBlock = src:match("if imp%.isNX then(.-)end\n\n %-%- Settings gear")
assert(nxBlock, "expected Switch-only version chip before the settings gear")
assert(nxBlock:find("Version%.engine", 1, false), "chip must show Version.engine")
assert(nxBlock:find('"v"', 1, true) or nxBlock:find('"v" %.%.', 1, false),
"chip label should be a v-prefixed version")
print("ok — Switch launcher version chip is NX-gated and uses Version.engine")