mirror of
https://github.com/tcsenpai/UWINE.git
synced 2025-06-07 03:55:21 +00:00
ulwgl_dl_util: move cache to func
- Code block in which the digest mismatched, user interrupt or failure to download/no internet.
This commit is contained in:
parent
fbb60288eb
commit
e3563cb8f3
@ -59,28 +59,10 @@ def get_ulwgl_proton(env: Dict[str, str]) -> Union[Dict[str, str], None]:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Cache
|
# Cache
|
||||||
# This point is reached when digests somehow mismatched or user interrupts the extraction process
|
# Refer to an old version previously installed
|
||||||
for tarball in cache.glob("GE-Proton*.tar.gz"):
|
# Reached on digest mismatch, user interrupt or download failure/no internet
|
||||||
# Ignore the mismatched file
|
if _get_from_cache(env, steam_compat, cache, files, False):
|
||||||
if files and tarball == cache.joinpath(files[1][0]):
|
return env
|
||||||
continue
|
|
||||||
|
|
||||||
print(f"{tarball.name} found in: {cache.as_posix()}")
|
|
||||||
try:
|
|
||||||
_extract_dir(tarball, steam_compat)
|
|
||||||
environ["PROTONPATH"] = steam_compat.joinpath(
|
|
||||||
tarball.name[: tarball.name.find(".")]
|
|
||||||
).as_posix()
|
|
||||||
env["PROTONPATH"] = environ["PROTONPATH"]
|
|
||||||
|
|
||||||
return env
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
proton: str = tarball.name[: tarball.name.find(".")]
|
|
||||||
|
|
||||||
if steam_compat.joinpath(proton).is_dir():
|
|
||||||
print(f"Purging {proton} in {steam_compat} ...")
|
|
||||||
rmtree(steam_compat.joinpath(proton).as_posix())
|
|
||||||
raise
|
|
||||||
|
|
||||||
# No internet and cache/compat tool is empty, just return and raise an exception from the caller
|
# No internet and cache/compat tool is empty, just return and raise an exception from the caller
|
||||||
return env
|
return env
|
||||||
@ -252,3 +234,29 @@ def _get_from_cache(
|
|||||||
rmtree(steam_compat.joinpath(proton).as_posix())
|
rmtree(steam_compat.joinpath(proton).as_posix())
|
||||||
|
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
# Refer to an old version previously installed
|
||||||
|
# Reached on digest mismatch, user interrupt or download failure/no internet
|
||||||
|
for tarball in cache.glob("GE-Proton*.tar.gz"):
|
||||||
|
# Ignore the mismatched file
|
||||||
|
if files and tarball == cache.joinpath(files[1][0]):
|
||||||
|
continue
|
||||||
|
|
||||||
|
print(f"{tarball.name} found in: {cache.as_posix()}")
|
||||||
|
try:
|
||||||
|
_extract_dir(tarball, steam_compat)
|
||||||
|
environ["PROTONPATH"] = steam_compat.joinpath(
|
||||||
|
tarball.name[: tarball.name.find(".")]
|
||||||
|
).as_posix()
|
||||||
|
env["PROTONPATH"] = environ["PROTONPATH"]
|
||||||
|
|
||||||
|
break
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
proton: str = tarball.name[: tarball.name.find(".")]
|
||||||
|
|
||||||
|
if steam_compat.joinpath(proton).is_dir():
|
||||||
|
print(f"Purging {proton} in {steam_compat} ...")
|
||||||
|
rmtree(steam_compat.joinpath(proton).as_posix())
|
||||||
|
raise
|
||||||
|
|
||||||
|
return env
|
||||||
|
Loading…
x
Reference in New Issue
Block a user