ulwgl_run.py: check dir before creating the symlink

- Setup can fail when creating the symlink if the pfx somehow exists already. One case this can probably happen is if the user references a Steam created prefix as the WINEPREFIX since pfx directory would exist.
This commit is contained in:
R1kaB3rN 2024-02-13 22:04:45 -08:00
parent 4ba702565d
commit 3bb00480b9
No known key found for this signature in database

View File

@ -44,9 +44,14 @@ example usage:
def setup_pfx(path: str) -> None:
"""Create a symlink to the WINE prefix and tracked_files file."""
if Path(path + "/pfx").expanduser().is_symlink():
Path(path + "/pfx").expanduser().unlink()
Path(path + "/pfx").expanduser().symlink_to(Path(path).expanduser())
pfx: Path = Path(path + "/pfx").expanduser()
if pfx.is_symlink():
pfx.unlink()
if not pfx.is_dir():
pfx.symlink_to(Path(path).expanduser())
Path(path + "/tracked_files").expanduser().touch()