From acfd8b67bd63cfcb909854427e0c24d75206ab4c Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Thu, 9 Apr 2020 20:06:43 +0300 Subject: [PATCH] Ignore process serial number (`-psn_...`) command line argument passed by macOS Gatekeeper. (cherry picked from commit e92a14ac5fa8e4fea3254e87b3449302bed3e6dd) --- main/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main/main.cpp b/main/main.cpp index 88d4dcc1fc1..908e883ca6b 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -427,6 +427,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph I = args.front(); while (I) { +#ifdef OSX_ENABLED + // Ignore the process serial number argument passed by macOS Gatekeeper. + // Otherwise, Godot would try to open a non-existent project on the first start and abort. + if (I->get().begins_with("-psn_")) { + I = I->next(); + continue; + } +#endif List::Element *N = I->next();