fix(downloads)!: preserve file extension for nested single-file ROMs#263
Merged
danielcopper merged 1 commit intomainfrom May 4, 2026
Merged
fix(downloads)!: preserve file extension for nested single-file ROMs#263danielcopper merged 1 commit intomainfrom
danielcopper merged 1 commit intomainfrom
Conversation
…226) When a ROM is stored as a single file inside a per-game folder in RomM (e.g. `Resident Evil/Resident Evil.chd`), the API sets `has_nested_single_file=true` and `fs_name` is the folder name without extension. The plugin used `fs_name` as the local target filename, so the downloaded ROM was stored without its extension and could not be launched. Resolve the on-disk filename from `files[0].file_name` when `has_nested_single_file=true`, falling back to `fs_name` with a warning if `files` is empty or missing. Nested-single-file ROMs land flat in the platform folder (no folder mirroring) — by definition they have no sidecars, so the parent folder adds no value locally, and flat layout matches `has_simple_single_file` behavior. Multi-file ROMs are unaffected. BREAKING CHANGE: Existing installs of nested single-file ROMs were stored locally without their file extension. Affected ROMs must be re-downloaded (or re-synced via the plugin) after updating so the on-disk filename is corrected — buggy entries cannot be patched in place.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Fixes #226. When a ROM is stored as a single file inside a per-game folder in RomM (e.g.
Resident Evil/Resident Evil.chd), the API setshas_nested_single_file=trueandfs_nameis the folder name without extension. The plugin usedfs_nameas the local target filename, so downloads were stored without the file extension and could not be launched.What changed
_resolve_local_file_namehelper picks the correct on-disk filename based on RomM's file-layout flags. Whenhas_nested_single_file=true, derive the filename fromfiles[0].file_name(which carries the extension); otherwise keep usingfs_name.filesis empty or missing on a nested-single-file ROM (shouldn't happen per RomM's API contract), fall back tofs_nameand log a warning.start_downloadand threaded through_do_downloadas a parameter — no double resolution, no duplicate warning logs.Backend-Architecture.md(separate wiki commit).Layout decision
Nested-single-file ROMs are placed flat in the platform folder (e.g.
dc/Resident Evil.chd), not mirroring the RomM folder structure. By definitionhas_nested_single_filemeans exactly one file in that folder — any sidecar files would flip RomM tohas_multiple_files. Flat layout matcheshas_simple_single_filebehavior; multi-file ROMs still keep their per-game subfolder.Breaking change
Existing local installs of nested-single-file ROMs are stored without their file extension. After this release, affected ROMs need to be re-downloaded (or re-synced) so the on-disk filename is corrected — buggy entries cannot be patched in place. release-please will surface this in the changelog.
Test plan
pytest tests/ -q— 1732 passed (7 new)ruff check py_modules tests main.py— cleanbasedpyright py_modules tests main.py— 0 errors / 0 warnings / 0 notes_resolve_local_file_name— 100% (line + branch)