def compile(
        self, items: list[ItemType] | None = None, path: str | None = None
    ) -> None:
        """
        Used to create the menu. Recursively iterates through each element in the top level menu.
        """
        if items == None:
            # run_admin()
            items = self.sub_items
            path = self.create_menu(self.name, self.path, self.icon_path)

        assert items is not None
        assert path is not None
        for item in items:
            if item.isMenu:
                # if the item is a menu
                submenu_path = self.create_menu(item.name, path, self.icon_path)
                self.compile(items=item.sub_items, path=submenu_path)
                continue

            # Otherwise the item is  a command
            if item.command == None:
                # If a Python function is defined
                func_name, func_file_name, func_dir_path = item.get_method_info()
                new_command = None
                if self.type in ["DIRECTORY_BACKGROUND", "DESKTOP_BACKGROUND"]:
                    # If it requires a background command
                    new_command = create_directory_background_command(
                        func_name, func_file_name, func_dir_path, item.params
                    )
                else:
                    # If it requires a file command
                    new_command = create_file_select_command(
                        func_name, func_file_name, func_dir_path, item.params
                    )
                self.create_command(item.name, path, new_command, item.icon_path)
            elif item.command_vars != None:
                # If the item has to be ran from os.system
                assert item.command is not None
                assert item.command_vars is not None
                new_command = create_shell_command(item.command, item.command_vars)
                self.create_command(item.name, path, new_command, item.icon_path)
            else:
                # The item is just a plain old command
                assert item.command is not None
                self.create_command(item.name, path, item.command, item.icon_path)

        Used to create the menu. Recursively iterates through each element in the top level menu.
        
context_menu/windows_menus.py