ulwgl_run: update logic for non-existent WINEPREFIX

- Prefer having two separate branches for when the prefix doesn't exist or in the case it's not set
This commit is contained in:
R1kaB3rN 2024-02-21 11:11:01 -08:00
parent a610be41d8
commit 11bd213088
No known key found for this signature in database

View File

@ -124,17 +124,12 @@ def check_env(
raise ValueError(err)
env["GAMEID"] = os.environ["GAMEID"]
if (
"WINEPREFIX" not in os.environ
or not Path(os.environ["WINEPREFIX"]).expanduser().is_dir()
):
if "WINEPREFIX" not in os.environ:
# Automatically create a prefix for the user if WINEPREFIX is not set
# The GAMEID will be the name of the dir
pfx: Path = Path.home().joinpath("Games/ULWGL/" + env["GAMEID"])
else:
pfx: Path = Path(os.environ["WINEPREFIX"])
if "WINEPREFIX" not in os.environ:
pfx: Path = Path.home().joinpath("Games/ULWGL/" + env["GAMEID"])
pfx.mkdir(parents=True, exist_ok=True)
os.environ["WINEPREFIX"] = pfx.as_posix()
if not Path(os.environ["WINEPREFIX"]).expanduser().is_dir():
pfx: Path = Path(os.environ["WINEPREFIX"])
pfx.mkdir(parents=True, exist_ok=True)
os.environ["WINEPREFIX"] = pfx.as_posix()