From 3bb00480b95fef8c2544bfea640fc685393bc29e Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Tue, 13 Feb 2024 22:04:45 -0800 Subject: [PATCH] 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. --- ulwgl_run.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ulwgl_run.py b/ulwgl_run.py index 7aa9e22..2a9e7e8 100755 --- a/ulwgl_run.py +++ b/ulwgl_run.py @@ -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()