Skip to content

Commit

Permalink
umu_run: update syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
R1kaB3rN committed Oct 22, 2024
1 parent 0361995 commit 5a1c055
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions umu/umu_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from _ctypes import CFuncPtr
from argparse import ArgumentParser, Namespace, RawTextHelpFormatter
from concurrent.futures import Future, ThreadPoolExecutor
from contextlib import suppress
from ctypes import CDLL, c_int, c_ulong
from errno import ENETUNREACH

Expand Down Expand Up @@ -498,28 +499,21 @@ def get_steam_layer_id() -> int:
steam_layer_id: int = 0

if path := os.environ.get("STEAM_COMPAT_TRANSCODED_MEDIA_PATH"):
try:
# Suppress cases when value is not a number or empty tuple
with suppress(ValueError, IndexError):
return int(Path(path).parts[-1])
except (ValueError, IndexError): # Value isn't a number or empty tuple
pass

if path := os.environ.get("STEAM_COMPAT_MEDIA_PATH"):
try:
with suppress(ValueError, IndexError):
return int(Path(path).parts[-2])
except (ValueError, IndexError):
pass

if path := os.environ.get("STEAM_FOSSILIZE_DUMP_PATH"):
try:
with suppress(ValueError, IndexError):
return int(Path(path).parts[-3])
except (ValueError, IndexError):
pass

if path := os.environ.get("DXVK_STATE_CACHE_PATH"):
try:
with suppress(ValueError, IndexError):
return int(Path(path).parts[-2])
except (ValueError, IndexError):
pass

return steam_layer_id

Expand Down

0 comments on commit 5a1c055

Please sign in to comment.