[FIX] Pick executable inside .app using metadata#5392
Conversation
CommandMC
left a comment
There was a problem hiding this comment.
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
src/backend/storeManagers/index.ts
Outdated
|
|
||
| // 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')) { |
There was a problem hiding this comment.
You're checking for if (!executable) above, so executable will always be truthy here
| if (executable && isMac && executable.endsWith('.app')) { | |
| if (isMac && executable.endsWith('.app')) { |
There was a problem hiding this comment.
I updated this, I also didn't need the endsWith(.app) check
src/backend/storeManagers/index.ts
Outdated
| const plistContent = readFileSync( | ||
| join(executable, 'Contents', 'Info.plist') | ||
| ).toString() |
There was a problem hiding this comment.
| const plistContent = readFileSync( | |
| join(executable, 'Contents', 'Info.plist') | |
| ).toString() | |
| const plistContent = readFileSync( | |
| join(executable, 'Contents', 'Info.plist'), | |
| 'utf-8' | |
| ) |
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 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 |
Currently, when we sideload a native mac app/game, the code is picking the first file it finds in the
Contents/MacOSdirectory 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
CFBundleExecutablemetadata 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: