Bases: PreLaunchHook
 Launch arguments preparation.
 Non python host implementation do not launch host directly but use python script which launch the host. For these cases it is necessary to prepend python (or openpype) executable and script path before application's.
  Source code in client/ayon_wrap/hooks/pre_host_launch.py
 | 12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57 | class PreLaunchHostHook(PreLaunchHook):
    """Launch arguments preparation.
    Non python host implementation do not launch host directly but use
    python script which launch the host. For these cases it is necessary to
    prepend python (or openpype) executable and script path before application's.
    """
    app_groups = {"wrap"}
    order = 20
    launch_types = {LaunchTypes.local}
    def execute(self):
        # Pop executable
        executable_path = self.launch_context.launch_args.pop(0)
        # Pop rest of launch arguments - There should not be other arguments!
        remainders = []
        while self.launch_context.launch_args:
            remainders.append(self.launch_context.launch_args.pop(0))
        script_path = os.path.join(
            WRAP_DIR,
            "api",
            "launch_logic.py"
        )
        new_launch_args = get_ayon_launcher_args(
            "run", script_path, executable_path
        )
        # Add workfile path if exists
        workfile_path = self.data["last_workfile_path"]
        if (
                self.data.get("start_last_workfile")
                and workfile_path
                and os.path.exists(workfile_path)
                and workfile_path not in new_launch_args):
            new_launch_args.append(workfile_path)
            if workfile_path in remainders:
                remainders.remove(workfile_path)
        # Append as whole list as these areguments should not be separated
        self.launch_context.launch_args.append(new_launch_args)
        if remainders:
            self.launch_context.launch_args.extend(remainders)
 |