Skip to content

feat(api): return relative paths with system ID in media.search and media.lookup#565

Merged
wizzomafizzo merged 2 commits intomainfrom
feat/relative-system-paths-in-search
Mar 18, 2026
Merged

feat(api): return relative paths with system ID in media.search and media.lookup#565
wizzomafizzo merged 2 commits intomainfrom
feat/relative-system-paths-in-search

Conversation

@wizzomafizzo
Copy link
Member

Summary

  • Add ToRelativePath method to LauncherCache that converts absolute media file paths to relative paths with the system ID as the first component (e.g., /mnt/games/SNES/USA/game.sfcSNES/USA/game.sfc)
  • Integrate into HandleMediaSearch and HandleMediaLookup API handlers so returned paths are portable across different mount points
  • Pure string manipulation using cached launcher data and platform root directories — no filesystem I/O at query time
  • URIs and unmatched paths are returned unchanged as a graceful fallback

…edia.lookup

Convert absolute file paths in media.search and media.lookup API responses
to relative paths with the system ID as the first component. This makes
paths portable across different mount points (e.g., removable drives) while
remaining human-readable and usable as launch paths.

Example: /mnt/games/SNES/USA/game.sfc → SNES/USA/game.sfc

The conversion uses cached launcher data and platform root directories for
pure string manipulation with no filesystem I/O at query time. URIs and
unmatched paths are returned unchanged.
@sentry
Copy link

sentry bot commented Mar 18, 2026

Codecov Report

❌ Patch coverage is 92.15686% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/helpers/launcher_cache.go 89.74% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

…older

filepath.IsAbs("/custom/ps2") returns false on Windows since it lacks a
drive letter. Use t.TempDir() to get a guaranteed-absolute path on all
platforms.
@wizzomafizzo wizzomafizzo merged commit 0451b51 into main Mar 18, 2026
10 checks passed
@wizzomafizzo wizzomafizzo deleted the feat/relative-system-paths-in-search branch March 18, 2026 09:08
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.

1 participant