Cover required imports across platforms

This commit is contained in:
anxiousintrovert
2026-08-15 10:56:58 -05:00
parent 52efdabf61
commit 9bf15c33fd
4 changed files with 85 additions and 0 deletions
+40
View File
@@ -44,6 +44,46 @@ check(importer.installedPath == [[C:\LocalState\picked_mod.zip]],
check(removedPath == [[C:\LocalState\picked_mod.zip]],
"removes the temporary copy after installation")
-- The UWP picker returns a temporary path rather than a mobile staged name.
-- Required imports must use that same picker and remain scoped to the selected
-- mod instead of relying on a desktop shell or Android/iOS inbox handling.
local pickedKind
love.system.pickFile = function(kind)
pickedKind = kind
return true
end
love.system.getPickedFile = function()
love.system.getPickedFile = function() return nil end
return [[C:\LocalState\picked_required_import.bin]]
end
removedPath = nil
local required = RomImporter.new(function() end, { launcher = true })
required.mods = { {
id = "needs-source",
manifest = {
id = "needs-source", name = "Needs source",
required_imports = { {
id = "source", name = "Source", file = "source.bin",
md5 = { "00000000000000000000000000000000" },
} },
},
} }
required._importRequiredSource = function(self, modId, importId, path)
self.requiredPath = { modId = modId, importId = importId, path = path }
return true
end
required:chooseRequiredImport("needs-source", "source")
check(pickedKind == "required_import", "UWP requests the required-import picker kind")
required:update(0)
check(required.requiredPath and required.requiredPath.path
== [[C:\LocalState\picked_required_import.bin]],
"UWP routes the picked dependency to its declared import")
check(required.requiredPath.modId == "needs-source"
and required.requiredPath.importId == "source",
"UWP preserves the pending mod and import identity")
check(removedPath == [[C:\LocalState\picked_required_import.bin]],
"UWP removes its temporary required-import copy after validation")
love.system.getOS = saved.getOS
love.system.pickFile = saved.pickFile
love.system.getPickedFile = saved.getPickedFile