From f3cbc1550afd6fd7d5054127f6b172a480da60fd Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 25 May 2021 10:15:31 +0200 Subject: [PATCH] added global prelaunch hook for mac prepending `open -an` arguments --- openpype/hooks/pre_mac_launch.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 openpype/hooks/pre_mac_launch.py diff --git a/openpype/hooks/pre_mac_launch.py b/openpype/hooks/pre_mac_launch.py new file mode 100644 index 0000000000..be4aa9839c --- /dev/null +++ b/openpype/hooks/pre_mac_launch.py @@ -0,0 +1,18 @@ +from openpype.lib import PreLaunchHook + + +class LaunchWithTerminal(PreLaunchHook): + """Mac specific pre arguments for application. + + Mac applications should be launched using "open" argument which is internal + callbacks to open executable. We also add argument "-an" to create new + process. This is used only for executables ending with ".app". It is + expected that these executables lead to app packages. + """ + order = 1000 + + platforms = ["darwin"] + + def execute(self): + if self.launch_context.executable.endswith(".app"): + self.launch_context.launch_args.insert(0, ["open", "-an"])