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) raise ValueError(err)
env["GAMEID"] = os.environ["GAMEID"] env["GAMEID"] = os.environ["GAMEID"]
if ( if "WINEPREFIX" not in os.environ:
"WINEPREFIX" not in os.environ pfx: Path = Path.home().joinpath("Games/ULWGL/" + env["GAMEID"])
or not Path(os.environ["WINEPREFIX"]).expanduser().is_dir() pfx.mkdir(parents=True, exist_ok=True)
): os.environ["WINEPREFIX"] = pfx.as_posix()
if "WINEPREFIX" not in os.environ: if not Path(os.environ["WINEPREFIX"]).expanduser().is_dir():
# Automatically create a prefix for the user if WINEPREFIX is not set pfx: Path = Path(os.environ["WINEPREFIX"])
# 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"])
pfx.mkdir(parents=True, exist_ok=True) pfx.mkdir(parents=True, exist_ok=True)
os.environ["WINEPREFIX"] = pfx.as_posix() os.environ["WINEPREFIX"] = pfx.as_posix()