mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 06:32:53 +01:00
feat: custom symlink creation in thread
This commit is contained in:
1 parent
a8b7ea5008
commit
e1cb682e74
8 files changed
+273
-130
No files matched your search
@@ -12,10 +12,13 @@ logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
def rebuild_symlinks(config: Path) -> None:
|
||||
# TODO: pass direct path as argument
|
||||
path = lookup(config, Preferences.DEFAULT)
|
||||
steam_path = Path(path)
|
||||
dayz_path = PeFile.get_nested_app_path(steam_path, APPID_DAYZ)
|
||||
# NOTE: unlink stale symlinks
|
||||
# TODO: expunge ephemeral (@C) links (possibility of name collisions)
|
||||
# if str(file)[:2] == "@C": file.unlink()
|
||||
for file in dayz_path.iterdir():
|
||||
if file.is_symlink() and file.exists() is False:
|
||||
file.unlink()
|
||||
@@ -30,6 +33,21 @@ def rebuild_symlinks(config: Path) -> None:
|
||||
clone_symlinks(steam_path)
|
||||
|
||||
|
||||
def create_custom_symlinks(steam_path: Path, custom_dir: Path, uids: list[str]) -> None:
|
||||
dayz_path = PeFile.get_nested_app_path(steam_path, APPID_DAYZ)
|
||||
links = []
|
||||
for uid in uids:
|
||||
md5sum = _hash(uid, use_custom=True)
|
||||
source = dayz_path.joinpath(md5sum)
|
||||
target = custom_dir.joinpath(uid)
|
||||
links.append(md5sum)
|
||||
if source.exists() is False:
|
||||
source.symlink_to(target)
|
||||
clone_symlinks(steam_path)
|
||||
return links
|
||||
|
||||
|
||||
|
||||
def clone_symlinks(steam_path: Path) -> None:
|
||||
"""
|
||||
Shares symlinks between builds. Used after any symlink operation
|
||||
|
||||
Reference in new issue
Block a user