浏览代码

Ignore process serial number (`-psn_...`) command line argument passed by macOS Gatekeeper.

(cherry picked from commit e92a14ac5fa8e4fea3254e87b3449302bed3e6dd)
bruvzg 5 年之前
父节点
当前提交
acfd8b67bd
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      main/main.cpp

+ 8 - 0
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<String>::Element *N = I->next();