def _link_local_copy(self, server_instance: ServerInstance) -> None: """Actually link the local copy.""" mod_folder = join(server_instance.get_server_instance_path(), server_instance.S.linked_mod_folder_name, "@" + self.name) mod_fix_settings = server_instance.S.fix_settings.mod_fix_settings local_folder = abspath(mod_fix_settings["odkai_local_path"]) symlink(local_folder, mod_folder)
def hook_init_copy_replace(self, server_instance: ServerInstance, call_data: List[str]) -> None: """Put the mod in copied_mods folder and symlink everything from the original mod, then simulate a regular folder structure.""" mod_name = call_data[2] target_mod_folder = join(server_instance.get_server_instance_path(), server_instance.S.copied_mod_folder_name, "@{}".format(mod_name)) self._do_op(mod_name, server_instance.S.arma_folder, target_mod_folder)
def hook_update_link_replace(self, server_instance: ServerInstance, call_data: List[str]) -> None: """Make sure the local copy is symlinked.""" mod_folder = join(server_instance.get_server_instance_path(), server_instance.S.linked_mod_folder_name, "@" + self.name) if islink(mod_folder): unlink(mod_folder) self._link_local_copy(server_instance)
def hook_update_copy_replace(self, server_instance: ServerInstance, call_data: List[str]) -> None: """Exactly the same as the init_copy, but ensure the folder is deleted first, to start anew.""" mod_name = call_data[2] target_mod_folder = join(server_instance.get_server_instance_path(), server_instance.S.copied_mod_folder_name, "@{}".format(mod_name)) if isdir(target_mod_folder): # Delete the old folder, it's better to start anew rmtree(target_mod_folder) self._do_op(mod_name, server_instance.S.arma_folder, target_mod_folder)
def _get_cba_path(instance: ServerInstance) -> str: """Return the path of the instance cba_settings.""" return join(instance.get_server_instance_path(), "userconfig", "cba_settings.sqf")