libretro / libretro/RetroArch

[macOS] ":" (colon) is not expanded properly in directory settings

Open
#16,803 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

platform: osx
Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

First and foremost consider this:

  • Only RetroArch bugs should be filed here. Not core bugs or game bugs
  • This is not a forum or a help section, this is strictly developer oriented

Description

On macOS, the default settings for audio_filter_dir, bundle_assets_src_path, and video_filter_dir are as follows:

audio_filter_dir = ":/Contents/Resources/filters/audio"
bundle_assets_src_path = ":/Contents/Resources/assets.zip"
video_filter_dir = ":/Contents/Resources/filters/video"

The ":" (colon) character is supposed to resolve to the location of the RetroArch app bundle (typically /Applications/RetroArch.app, assuming the app is placed in the suggested directory and not renamed). However, any spaces in the path are interpreted as "%20", which causes the wrong directories to be loaded.

This behavior can be seen when using this Homebrew cask for the nightly build, which renames RetroArch.app to RetroArch Nightly.app to avoid conflicts with the stable build.

Expected behavior

The ":" (colon) expands to the location of the app bundle. (i.e. /Applications/RetroArch Nightly.app).

Actual behavior

The spaces (and possibly other characters) in the path to the app bundle are not escaped properly (i.e. /Applications/RetroArch%20Nightly.app).

Pure speculation, but this may be due to a conflict with other settings like core_updater_buildbot_assets_url, which expect an online URL rather than a local directory/file. Perhaps the presence of ":/" causes the string to be interpreted incorrectly?

Steps to reproduce the bug
  1. Place RetroArch.app in /Applications and run it once to generate the default retroarch.cfg.
  2. Rename RetroArch.app to RetroArch Nightly.app, which contains a space.
  3. Observe the following behavior:
  • In Settings > Video > Video Filter, no video filters are listed.
  • In Settings > Audio > DSP Plugin, no audio filters are listed.
  • A "fake app" named RetroArch%20Nightly.app is created next to RetroArch Nightly.app. (macOS treats all files with the .app extension as launch-able apps, but attempting to do so only gives the OS-standard "damaged or incomplete" message.) It contains Contents/Resources/filters/audio and Contents/Resources/filters/video. This is where RetroArch is looking for audio and video filters. These directories will be created every time RetroArch is opened.

Interestingly, if RetroArch.app is renamed before it is ran for the first time, then the aforementioned values in the generated retroarch.cfg are edited to use the full app path rather than ":" expansion. (This means the assets are always able to be extracted on the first launch.) However, if the app is renamed after that, then a similar "fake app" issue will occur, since the old app path will no longer exist. Ideally, ":" expansion should still be used in these cases, but fixed so all characters are properly escaped.

Bisect Results

The same behavior appears to occur on every version since stable 1.9.0.

Version/Commit

You can find this information under Information/System Information

  • RetroArch: 1.19.1 (nightly c208186df)
Environment information
  • OS: macOS Sonoma 14.5
  • Compiler: N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue by renaming the macOS app bundle to include a space, then trace how the ':' directory settings expand the bundle path. Verify the behavior for audio_filter_dir, bundle_assets_src_path, and video_filter_dir; the fix is complete when paths preserve spaces and filters and bundled assets load from the renamed app.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, macos
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.