Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS? Heroic does not load games when in a folder with spaces #406

Closed
StefanLobbenmeier opened this issue Jun 5, 2021 · 12 comments
Closed

Comments

@StefanLobbenmeier
Copy link
Contributor

StefanLobbenmeier commented Jun 5, 2021

Describe the bug
I just built this for macOS and installed it to the Applications folder. I opened it and it was stuck loading the games list.
I then started the binary via the terminal to see the logs:

➜  MacOS pwd                       
/Applications/Heroic Games Launcher.app/Contents/MacOS
➜  MacOS ./Heroic\ Games\ Launcher 
Default Wine not installed
Default Wine not installed
Protocol already registered.
Error occurred in handler for 'checkGameUpdates': Error: Command failed: /Applications/Heroic Games Launcher.app/Contents/Resources/app.asar.unpacked/build/bin/darwin/legendary list-installed --check-updates --tsv
/bin/sh: /Applications/Heroic: No such file or directory

    at ChildProcess.exithandler (child_process.js:317:12)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
    at Socket.<anonymous> (internal/child_process.js:439:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:673:12) {
  killed: false,
  code: 127,
  signal: null,
  cmd: '/Applications/Heroic Games Launcher.app/Contents/Resources/app.asar.unpacked/build/bin/darwin/legendary list-installed --check-updates --tsv',
  stdout: '',
  stderr: '/bin/sh: /Applications/Heroic: No such file or directory\n'
}
^C% 

To Reproduce
Steps to reproduce the behavior:

  1. Launch Heroic from a folder with spaces (e.g. default installation on macOS)

Expected behavior
The game list is shown

Screenshots
Screenshot of Heroic when stuck loading:
image

Desktop (please complete the following information):

Additional context
Add any other context about the problem here.

@StefanLobbenmeier
Copy link
Contributor Author

By the way, feel free to reproduce on other platforms and comment if this is only macOS. I guess the same behaviour could occur on other platforms as well, but it is installed differently there. Or there is a bug specific to the macOS implementation of resolving that path that forgot to insert quotes.

@StefanLobbenmeier
Copy link
Contributor Author

Looking at the source code the issue probably occurs in that line:

const command = `${legendaryBin} list-installed --check-updates --tsv`
(I could be wrong, haven't run it with debugger)

Which means that this line should be fixed?

const legendaryBin = fixPathForAsarUnpack(join(__dirname, '/bin/', process.platform, isWindows ? '/legendary.exe' : '/legendary'))

@flavioislima
Copy link
Member

By the way, feel free to reproduce on other platforms and comment if this is only macOS. I guess the same behaviour could occur on other platforms as well, but it is installed differently there. Or there is a bug specific to the macOS implementation of resolving that path that forgot to insert quotes.

No, this doesn't happens on Linux or Windows.
Might be just the name of the folder when building because it's trying to find the legendary binary.
So maybe we just need to change the build config of macos to call the app just heroic instead of the full name.

@entaromia created the mac version, so he probably knows best.

@StefanLobbenmeier
Copy link
Contributor Author

StefanLobbenmeier commented Jun 5, 2021

I think it should also work in a folder with blanks in it (e.g. the user could also rename it afterwards). The recommended fix is to wrap the executable in quotes: nodejs/node#6803

@Nocccer
Copy link
Collaborator

Nocccer commented Jun 6, 2021

Maybe this happens because i removed alot of stuff which was wrapped like this:
'`${filePahts[0]}`'
and i changed it to:
filePaths[0]

@flavioislima
Copy link
Member

Should be fixed on the main branch now @StefanLobbenmeier

@StefanLobbenmeier
Copy link
Contributor Author

Actually master has a different issue now, does not start at all:

(node:35701) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of undefined
    at /Applications/Heroic Games Launcher.app/Contents/Resources/app.asar/build/main.js:171:66
    at Generator.next (<anonymous>)
    at fulfilled (/Applications/Heroic Games Launcher.app/Contents/Resources/app.asar/build/main.js:24:58)
(Use `Heroic Games Launcher --trace-warnings ...` to show where the warning was created)
(node:35701) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:35701) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@adityaruplaha
Copy link
Contributor

Crap, something must've broken pretty bad.

@flavioislima
Copy link
Member

Crap, something must've broken pretty bad.

That would be new 😅

@Linux4Good
Copy link
Contributor

Thats my fault.
I forgot to limit the python version check to linux.
So its trying to read the python version on mac and its getting undefined. Simple fix.
I'll do it on my branch but if you want to fix it yourself @StefanLobbenmeier, remove the python check on lines 195 and 255 of main.js.

@flavioislima
Copy link
Member

Fixed on main branch

@StefanLobbenmeier
Copy link
Contributor Author

Fixed on main branch

I just confirmed as well 😃 thanks for the fast fix

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

No branches or pull requests

5 participants