feat(nx-mods): rescan installs zips and retains failures

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Andrew Quenehen
2026-08-01 05:21:01 -03:00
parent d4455c508f
commit 43755c5457
2 changed files with 103 additions and 0 deletions
+30
View File
@@ -429,6 +429,36 @@ function RomImporter:scanModsInbox()
return listZipPaths(MODS_INBOX_DIR)
end
-- Rescan imports/mods/: install each .zip via _installMod / installZip.
-- Never deletes inbox zips (success or failure). Empty inbox → MTP notice.
function RomImporter:rescanModsAction()
if self.workState == "working" then return end
self.tab = "mods"
self:ensureModsInboxDir()
local candidates = self:scanModsInbox()
if #candidates == 0 then
self:_setNxModsInboxNotice()
return
end
local anyOk = false
local lastFail = nil
for _, path in ipairs(candidates) do
-- Reuse _installMod carefully: it must not remove the inbox source.
self:_installMod(path)
if self.modNotice and self.modNotice.ok then
anyOk = true
else
lastFail = self.modNotice
end
end
if lastFail and not anyOk then
self.modNotice = lastFail
elseif lastFail and anyOk then
-- Mixed: keep failure visible after successes refreshed the list.
self.modNotice = lastFail
end
end
function RomImporter:rescanAction(version)
if self.workState == "working" then return end
version = version or self.tab or "red"