mirror of
https://github.com/rommapp/romm.git
synced 2026-06-27 22:35:57 +00:00
Fix: Arcade platform renamed to FBNeo after adding variant folder
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/c7fa6f9d-b4d5-4d56-9d64-bd46bb18f17b Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a57992d83c
commit
4e6288052e
@@ -455,6 +455,13 @@ async def _identify_platform(
|
||||
scanned_platform = await scan_platform(platform_slug, fs_platforms)
|
||||
if platform:
|
||||
scanned_platform.id = platform.id
|
||||
# When the slug changes (e.g. the folder was re-mapped as a variant of a
|
||||
# different base platform via PLATFORMS_VERSIONS), the old custom_name no
|
||||
# longer applies to the new platform identity. Explicitly reset it so
|
||||
# that session.merge() clears the stale value in the database and the
|
||||
# platform displays its canonical metadata name instead.
|
||||
if platform.slug != scanned_platform.slug:
|
||||
scanned_platform.custom_name = ""
|
||||
|
||||
await scan_stats.increment(
|
||||
socket_manager=socket_manager,
|
||||
|
||||
@@ -26,7 +26,19 @@ def get_supported_platforms() -> list[PlatformSchema]:
|
||||
Flashpoint, and HowLongToBeat.
|
||||
"""
|
||||
db_platforms = db_platform_handler.get_platforms()
|
||||
db_platforms_map = {p.slug: p for p in db_platforms}
|
||||
|
||||
# Build a slug → platform map, preferring the "canonical" platform when
|
||||
# multiple DB entries share the same slug (e.g. when several folder variants
|
||||
# all point to the same base platform after a scan). A platform is
|
||||
# considered canonical when its folder name matches the slug
|
||||
# (case-insensitively), i.e. the folder was not remapped via
|
||||
# PLATFORMS_VERSIONS / PLATFORMS_BINDING. When no canonical entry exists
|
||||
# the first entry encountered (ordered by name ASC in the DB query) wins.
|
||||
db_platforms_map: dict[str, Platform] = {}
|
||||
for p in db_platforms:
|
||||
slug = p.slug
|
||||
if slug not in db_platforms_map or p.fs_slug.lower() == slug.lower():
|
||||
db_platforms_map[slug] = p
|
||||
|
||||
now = datetime.now(timezone.utc)
|
||||
supported_platforms = []
|
||||
|
||||
Reference in New Issue
Block a user