fix: keep save and content files out of the truth

This commit is contained in:
Abdessamad Derraz committed 2026-10-06 12:48:58 +02:00
1 parent 443639c33d
commit 9ca14bb77e
6 files changed
+48 -10

No files matched your search

+2 -3
View File
@@ -31,6 +31,7 @@ from common import (
require_yaml,
runs_standalone,
)
from validation import read_from_system_dir
yaml = require_yaml()
@@ -332,9 +333,7 @@ def _cross_reference_profile(
if file_mode == "libretro" and is_standalone:
continue
# Skip files loaded from non-system directories (save_dir, content_dir)
load_from = f.get("load_from", "")
if load_from and load_from != "system_dir":
if not read_from_system_dir(f):
continue
# Skip filename-agnostic files (handled by agnostic scan)
+2 -3
View File
@@ -14,6 +14,7 @@ from common import resolve_local_file
from common import runs_standalone
from common import sanitize_pack_path
from common import size_fits
from validation import read_from_system_dir
def _emulator_systems_index(emu_profiles: dict | None) -> dict[str, list[str]]:
"""Map both the profile key and its display name to the profile's systems.
@@ -564,9 +565,7 @@ def _collect_emulator_extras(
continue
if file_mode == "libretro" and is_standalone:
continue
# Skip files loaded from non-system directories (save_dir, content_dir)
load_from = f.get("load_from", "")
if load_from and load_from != "system_dir":
if not read_from_system_dir(f):
continue
if is_standalone:
raw = f.get("standalone_path") or f.get("path") or fname
+3 -1
View File
@@ -9,7 +9,7 @@ from __future__ import annotations
import sys
from common import _norm_system_id, resolve_platform_cores, runs_standalone
from validation import filter_files_by_mode
from validation import filter_files_by_mode, read_from_system_dir
def _serialize_source_ref(sr: object) -> str:
@@ -378,6 +378,8 @@ def generate_platform_truth(
)
for fe in filtered:
if not read_from_system_dir(fe):
continue
profile_sid = fe.get("system", "")
if not profile_sid:
sys_ids = profile.get("systems", [])
+11
View File
@@ -313,6 +313,17 @@ def validate_cli_modes(args, mode_attrs: list[str]) -> None:
raise SystemExit(f"Options are mutually exclusive: --{' --'.join(mode_attrs)}")
def read_from_system_dir(file_entry: dict) -> bool:
"""Whether the emulator reads this entry from the system directory.
A file loaded from the save, content or working directory is not a BIOS:
no platform lists it, no pack carries it, and the truth model must not
ask a platform to declare it.
"""
load_from = file_entry.get("load_from", "")
return not load_from or load_from == "system_dir"
def filter_files_by_mode(files: list[dict], standalone: bool) -> list[dict]:
"""Filter file entries by libretro/standalone mode."""
result = []
+2 -3
View File
@@ -79,6 +79,7 @@ from validation import (
check_file_validation,
filter_files_by_mode,
find_validated_variant,
read_from_system_dir,
)
DEFAULT_DB = "database.json"
@@ -404,9 +405,7 @@ def _candidate_verdict(
return "skip"
if file_mode == "libretro" and is_standalone:
return "skip"
# Read from somewhere other than the system directory: not a BIOS gap.
load_from = file_entry.get("load_from", "")
if load_from and load_from != "system_dir":
if not read_from_system_dir(file_entry):
return "skip"
# Filename-agnostic entries are answered by the builder's own scan.
if file_entry.get("agnostic"):