fix: read exportable through the exporter instance

This commit is contained in:
Abdessamad Derraz committed 2026-10-16 15:57:43 +02:00
1 parent 0198445ee4
commit c6cac0ad1b
3 files changed
+22 -4

No files matched your search

+4 -4
View File
@@ -81,9 +81,8 @@ class BaseExporter(ABC):
# Shared helpers
@classmethod
def exportable(
cls,
self,
systems: dict[str, NativeSystem],
require: str = "",
) -> list[tuple[NativeSystem, list[NativeFile]]]:
@@ -92,11 +91,12 @@ class BaseExporter(ABC):
`require` names a hash the format cannot omit. An entry the format
has no way to express is dropped here and counted by the caller,
never written as a half entry the platform would read as a file that
can never verify.
can never verify. Read through the instance: RomM decides on the
keys its render has seen.
"""
result: list[tuple[NativeSystem, list[NativeFile]]] = []
for system in systems.values():
files = [fe for fe in system.files if fe.name and cls.writable(fe, require)]
files = [fe for fe in system.files if fe.name and self.writable(fe, require)]
if files:
result.append((system, files))
return result
+6
View File
@@ -52,6 +52,12 @@ class Exporter(BaseExporter):
def native_sources() -> dict[str, str]:
return {"known_bios_files.json": SOURCE_URL}
def __init__(self) -> None:
super().__init__()
# Filled by render; empty until then, so writable() answers before it.
self._platform_keys: set[tuple[str, str]] = set()
self._first_addition: dict[tuple[str, str], int] = {}
@staticmethod
def _verifiable(fe: NativeFile) -> bool:
return bool(fe.size()) and any(