macOS: ignore spurious -psn_ command line argument.

Fixes #602.
This commit is contained in:
whitequark 2020-05-10 07:28:42 +00:00
parent 1442ee5ec3
commit 9951da8965

View File

@ -1443,6 +1443,12 @@ static SSApplicationDelegate *ssDelegate;
std::vector<std::string> InitGui(int argc, char **argv) { std::vector<std::string> InitGui(int argc, char **argv) {
std::vector<std::string> args = InitCli(argc, argv); std::vector<std::string> args = InitCli(argc, argv);
if(args.size() >= 2 && args[1].find("-psn_") == 0) {
// For unknown reasons, Finder passes a Carbon PSN (Process Serial Number) argument
// when a freshly downloaded application is run for the first time. Remove it so
// that it isn't interpreted as a filename.
args.erase(args.begin() + 1);
}
ssDelegate = [[SSApplicationDelegate alloc] init]; ssDelegate = [[SSApplicationDelegate alloc] init];
NSApplication.sharedApplication.delegate = ssDelegate; NSApplication.sharedApplication.delegate = ssDelegate;