Skip to content

Fix media lookup by title for game files in subdirectories - #1190

Open
theluckystrike wants to merge 1 commit into
mmatyas:masterfrom
theluckystrike:fix/1172-nested-media-by-title
Open

theluckystrike wants to merge 1 commit into
mmatyas:masterfrom
theluckystrike:fix/1172-nested-media-by-title

Conversation

@theluckystrike

Copy link
Copy Markdown

Fixes #1172

When a game file sits in a subdirectory of the collection, for example Minecraft/start.sh, media stored by title in the collection's media/Minecraft/ folder is never picked up. MediaProvider looks for media under <game dir>/media/<title>, but the title key it matches against was built from the game file's own folder, so for a nested file it pointed at <root>/Minecraft/Minecraft instead of <root>/Minecraft.

The lookup map now also adds <game dir>/<title> when the file's folder is inside one of the game dirs. The old key still goes in first. Nothing changes for existing layouts. The prefix check includes the trailing slash, so a dir like snes2 doesn't count as being inside snes.

The new test asset_search_by_title_nested puts the game file under subdir/ and the box art under media/My Precious Game/, then checks that the game gets that boxFront, which it doesn't when the new loop is disabled. With the loop in place all 7 tests in test_PegasusMediaProvider pass on Qt 5.15 (macOS).

Michael

Media is searched in <game dir>/media/<title>, but the title key was
built from the game file's own directory, so a file like
Minecraft/start.sh never matched media/Minecraft/. Also add the key
relative to each game dir that contains the file, after the existing
keys so no current layout changes.

Fixes mmatyas#1172

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Media not recognized for nested game files

1 participant