mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-19 20:20:19 +02:00
refactor(import): drop redundant mobileFileBridge or and unused ready
scanInbox never consulted ready, and mobileFileBridge already mirrors android on Android/iOS, so the dual guard was a no-op. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -506,8 +506,7 @@ local function listSavPaths(dir)
|
|||||||
return paths
|
return paths
|
||||||
end
|
end
|
||||||
|
|
||||||
function RomImporter:scanInbox(ready)
|
function RomImporter:scanInbox()
|
||||||
ready = ready or self.ready
|
|
||||||
local paths = {}
|
local paths = {}
|
||||||
for _, path in ipairs(listRomPaths(IMPORTS_DIR)) do
|
for _, path in ipairs(listRomPaths(IMPORTS_DIR)) do
|
||||||
paths[#paths + 1] = path
|
paths[#paths + 1] = path
|
||||||
@@ -683,7 +682,7 @@ function RomImporter:rescanAction(version)
|
|||||||
self.chooseVersion = version
|
self.chooseVersion = version
|
||||||
self:ensureImportsDir()
|
self:ensureImportsDir()
|
||||||
local ready = self.ready
|
local ready = self.ready
|
||||||
local candidates = self:scanInbox(ready)
|
local candidates = self:scanInbox()
|
||||||
local sawReadyOnly = false
|
local sawReadyOnly = false
|
||||||
for _, path in ipairs(candidates) do
|
for _, path in ipairs(candidates) do
|
||||||
local data = love.filesystem.read(path)
|
local data = love.filesystem.read(path)
|
||||||
@@ -1660,7 +1659,7 @@ function RomImporter:choose(version)
|
|||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if self.mobileFileBridge or self.android then
|
if self.mobileFileBridge then
|
||||||
-- Prefer a not-yet-imported .gb/.gbc already in the save dir (USB copy, or
|
-- Prefer a not-yet-imported .gb/.gbc already in the save dir (USB copy, or
|
||||||
-- a fresh SAF pick). Never reuse an already-imported cart's file -- that
|
-- a fresh SAF pick). Never reuse an already-imported cart's file -- that
|
||||||
-- was the #167 failure mode (second Choose just re-extracted Red).
|
-- was the #167 failure mode (second Choose just re-extracted Red).
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ eq(zips[1], "imports/mods/valid.zip", "scanModsInbox path is under imports/mods/
|
|||||||
ri = freshImporter()
|
ri = freshImporter()
|
||||||
love.filesystem.write("imports/modpack.zip", "ZIPROM")
|
love.filesystem.write("imports/modpack.zip", "ZIPROM")
|
||||||
love.filesystem.write("imports/mods/also.zip", "ZIPMOD")
|
love.filesystem.write("imports/mods/also.zip", "ZIPMOD")
|
||||||
local roms = ri:scanInbox(ri.ready)
|
local roms = ri:scanInbox()
|
||||||
for _, path in ipairs(roms) do
|
for _, path in ipairs(roms) do
|
||||||
check(not path:lower():match("%.zip$"),
|
check(not path:lower():match("%.zip$"),
|
||||||
"ROM scanInbox ignores zip: " .. tostring(path))
|
"ROM scanInbox ignores zip: " .. tostring(path))
|
||||||
@@ -123,7 +123,7 @@ eq(#roms, 0, "ROM scanInbox finds no zip-only inbox entries")
|
|||||||
ri = freshImporter()
|
ri = freshImporter()
|
||||||
love.filesystem.write("imports/cart.gb", string.rep("G", 16))
|
love.filesystem.write("imports/cart.gb", string.rep("G", 16))
|
||||||
love.filesystem.write("imports/sidecar.zip", "NOTAROM")
|
love.filesystem.write("imports/sidecar.zip", "NOTAROM")
|
||||||
roms = ri:scanInbox(ri.ready)
|
roms = ri:scanInbox()
|
||||||
local sawGb, sawZip = false, false
|
local sawGb, sawZip = false, false
|
||||||
for _, path in ipairs(roms) do
|
for _, path in ipairs(roms) do
|
||||||
if path:lower():match("%.zip$") then sawZip = true end
|
if path:lower():match("%.zip$") then sawZip = true end
|
||||||
@@ -221,7 +221,7 @@ check(not (ri.modNotice.text or ""):find("failed", 1, true),
|
|||||||
ri = freshImporter()
|
ri = freshImporter()
|
||||||
love.filesystem.write("imports/._cart.gb", string.rep("X", 16))
|
love.filesystem.write("imports/._cart.gb", string.rep("X", 16))
|
||||||
love.filesystem.write("imports/cart.gb", string.rep("G", 16))
|
love.filesystem.write("imports/cart.gb", string.rep("G", 16))
|
||||||
roms = ri:scanInbox(ri.ready)
|
roms = ri:scanInbox()
|
||||||
local sawHidden, sawReal = false, false
|
local sawHidden, sawReal = false, false
|
||||||
for _, path in ipairs(roms) do
|
for _, path in ipairs(roms) do
|
||||||
if path:find("._cart", 1, true) then sawHidden = true end
|
if path:find("._cart", 1, true) then sawHidden = true end
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ eq(savs[1], "imports/saves/red/valid.sav", "scanSavesInbox path is under imports
|
|||||||
ri = freshImporter()
|
ri = freshImporter()
|
||||||
love.filesystem.write("imports/saves/red/cart.sav", string.rep("S", 32))
|
love.filesystem.write("imports/saves/red/cart.sav", string.rep("S", 32))
|
||||||
love.filesystem.write("imports/saves/red/dump.gb", string.rep("G", 16))
|
love.filesystem.write("imports/saves/red/dump.gb", string.rep("G", 16))
|
||||||
local roms = ri:scanInbox(ri.ready)
|
local roms = ri:scanInbox()
|
||||||
for _, path in ipairs(roms) do
|
for _, path in ipairs(roms) do
|
||||||
check(not path:lower():match("%.sav$"),
|
check(not path:lower():match("%.sav$"),
|
||||||
"ROM scanInbox ignores .sav: " .. tostring(path))
|
"ROM scanInbox ignores .sav: " .. tostring(path))
|
||||||
|
|||||||
Reference in New Issue
Block a user