Skip to content

[FIX] Pick executable inside .app using metadata#5392

Open
arielj wants to merge 2 commits intomainfrom
fix-app-file-executable
Open

[FIX] Pick executable inside .app using metadata#5392
arielj wants to merge 2 commits intomainfrom
fix-app-file-executable

Conversation

@arielj
Copy link
Copy Markdown
Collaborator

@arielj arielj commented Mar 5, 2026

Currently, when we sideload a native mac app/game, the code is picking the first file it finds in the Contents/MacOS directory but the first file is not necessarily the one that should be executed.

This PR changes that to use the plist file metadata to read the CFBundleExecutable metadata to know what file should be used.

This has a few more benefits:

I tested running a sideloaded native, non-native, and browser game, they all worked fine.


Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

@arielj arielj requested review from a team and Etaash-mathamsetty and removed request for a team March 5, 2026 00:04
@arielj arielj added the pr:ready-for-review Feature-complete, ready for the grind! :P label Mar 5, 2026
Copy link
Copy Markdown
Member

@CommandMC CommandMC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like that we have to do all this manual work. A brief search suggests we can use the open command to open a .app file directly (leaving the whole executable detection part up to the OS), although that would involve passing arguments differently


// we can't execute a `.app` file directly
// we have to use the path of the script inside the .app directory
if (executable && isMac && executable.endsWith('.app')) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're checking for if (!executable) above, so executable will always be truthy here

Suggested change
if (executable && isMac && executable.endsWith('.app')) {
if (isMac && executable.endsWith('.app')) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this, I also didn't need the endsWith(.app) check

Comment on lines +112 to +114
const plistContent = readFileSync(
join(executable, 'Contents', 'Info.plist')
).toString()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const plistContent = readFileSync(
join(executable, 'Contents', 'Info.plist')
).toString()
const plistContent = readFileSync(
join(executable, 'Contents', 'Info.plist'),
'utf-8'
)

@arielj
Copy link
Copy Markdown
Collaborator Author

arielj commented Mar 15, 2026

I don't really like that we have to do all this manual work. A brief search suggests we can use the open command to open a .app file directly (leaving the whole executable detection part up to the OS), although that would involve passing arguments differently

I did try just launching the .app file the same way we launch other executables, but it fails to launch .app files.

I'll try with open just to double check, but I did have issues in other PRs related to opening .app files (the zoom mac support and the run without wine PRs had this same issue while I was developing them)

I do think it's safer to keep this logic, because we still need this calculation for the no-wine feature and in those cases we tell legendary/gogdl/nile to run a game and those are not handling .app files correctly from my tests, and we would need those tools to be updated first if we want to not depend on this

@arielj arielj requested a review from CommandMC April 4, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:ready-for-review Feature-complete, ready for the grind! :P

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants