Use SDL's SDL_DROPFILE event to receive URLs to handle on macOS for URL protocol schemes listed in the AppBundle Info.plist. This also handles URLs while the game is running (connect to new server) instead of nothing happening when clicking a link while the game is running.
This fixes the macOS client and server being completely unusable when run from a terminal. They blocked forever in [NSApp run]; which was called by Sys_InitProtocolHandler(). applicationDidFinishLaunching was never called to exit the NSApp run loop.
I didn't manage to find a way to know whether it was run from terminal or launch services (?) to not enter [NSApp run] or another way to allow bailing out of [NSApp run]. So use the SDL event instead.
Use SDL's SDL_DROPFILE event to receive URLs to handle on macOS for URL protocol schemes listed in the AppBundle Info.plist. This also handles URLs while the game is running (connect to new server) instead of nothing happening when clicking a link while the game is running.
This fixes the macOS client and server being completely unusable when run from a terminal. They blocked forever in
[NSApp run];
which was called by Sys_InitProtocolHandler().applicationDidFinishLaunching
was never called to exit the NSApp run loop.I didn't manage to find a way to know whether it was run from terminal or launch services (?) to not enter
[NSApp run]
or another way to allow bailing out of[NSApp run]
. So use the SDL event instead.