mirror of
https://github.com/aclist/dztui.git
synced 2026-08-27 10:17:31 +02:00
feat: make symlink to mission path
Some checks are pending
Mirror to Codeberg / mirror-to-codeberg (push) Waiting to run
Some checks are pending
Mirror to Codeberg / mirror-to-codeberg (push) Waiting to run
This commit is contained in:
parent
4b16edbbee
commit
b8230cbf43
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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:
|
||||
"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user