From b8230cbf43fe9083c199e6f788f58b07f248a4c1 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 14 Jun 2026 01:54:08 +0900 Subject: [PATCH] feat: make symlink to mission path --- dzgui/managers/connection.py | 1 + dzgui/managers/offline.py | 14 ++++++++++++-- dzgui/util/symlink.py | 11 +++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/dzgui/managers/connection.py b/dzgui/managers/connection.py index a1aa0a9..d127dab 100644 --- a/dzgui/managers/connection.py +++ b/dzgui/managers/connection.py @@ -277,6 +277,7 @@ class ConnectionManager: self.thread_man.show_cancel(False) self.thread_man.update_dialog(waiting_for_launch) while True: + # FIXME: cancel should not be visible here per setting above if self.controller.is_cancel_pending(): # TODO: some facility to also close spawned steam process return diff --git a/dzgui/managers/offline.py b/dzgui/managers/offline.py index 99efca7..b4ab039 100644 --- a/dzgui/managers/offline.py +++ b/dzgui/managers/offline.py @@ -1,4 +1,5 @@ import logging +import time from pathlib import Path from typing import Callable, TYPE_CHECKING, Union @@ -7,10 +8,11 @@ from dzgui.api.mods import is_mission, get_custom_mods from dzgui.api.steam import launch_offline from dzgui.const.constants import APP_NAME, APPID_DAYZ_EXP from dzgui.const.enum import Preferences +from dzgui.init.proc import is_dayz_running from dzgui.managers.threading import call_on_thread, StoredFunc, ThreadingManager from dzgui.model.model_factory import ModelFactory from dzgui.strings import dialogs -from dzgui.util.symlink import create_custom_symlinks +from dzgui.util.symlink import create_custom_symlinks, symlink_mission from dzgui.views.dialogs.filepicker import FolderPicker if TYPE_CHECKING: @@ -92,7 +94,15 @@ class OfflineManager: Path(steam_path), Path(custom_folder), custom_mods ) combined_mods.extend(new_symlinks) - launch_offline(client, appid, name, combined_mods, mission) + + if len(mission) > 0: + relative_link = symlink_mission(Path(steam_path), mission) + + launch_offline(client, appid, name, combined_mods, relative_link) + while True: + if is_dayz_running(): + break + time.sleep(1) def open_folderpicker(self, title: str) -> Union["Path", None]: picker = FolderPicker(self.controller.get_window(), title) diff --git a/dzgui/util/symlink.py b/dzgui/util/symlink.py index 7d21539..715131a 100644 --- a/dzgui/util/symlink.py +++ b/dzgui/util/symlink.py @@ -49,6 +49,17 @@ def create_custom_symlinks( clone_symlinks(steam_path) return links +def symlink_mission(steam_path: Path, target: str) -> None: + dayz_path = PeFile.get_nested_app_path(steam_path, APPID_DAYZ) + for file in dayz_path.iterdir(): + if file.is_symlink() and str(file.stem)[:2] == "@C": + file.unlink() + stem = Path(target).name + suffix = _hash(stem, use_custom=True) + source = dayz_path.joinpath(suffix) + source.symlink_to(Path(target)) + return suffix + def clone_symlinks(steam_path: Path) -> None: """