mirror of
https://github.com/aclist/dztui.git
synced 2026-08-30 03:37:00 +02:00
Compare commits
No commits in common. "1760e6e92820ecef4249b916632a31e2e904f1d5" and "b50d061e1fe7376df03b38fa46f49ed870fad0f5" have entirely different histories.
1760e6e928
...
b50d061e1f
@ -15,7 +15,6 @@ from dzgui.const.constants import (
|
|||||||
APPID_DAYZ,
|
APPID_DAYZ,
|
||||||
APPID_DAYZ_EXP,
|
APPID_DAYZ_EXP,
|
||||||
APP_NAME,
|
APP_NAME,
|
||||||
DAYZ_BINARY,
|
|
||||||
DEBIAN_STEAM_PATH,
|
DEBIAN_STEAM_PATH,
|
||||||
DEFAULT_STEAM_PATH,
|
DEFAULT_STEAM_PATH,
|
||||||
FLATPAK_STEAM_PATH,
|
FLATPAK_STEAM_PATH,
|
||||||
@ -39,16 +38,19 @@ logger = logging.getLogger(APP_NAME)
|
|||||||
|
|
||||||
class AppNotInstalledError(Exception):
|
class AppNotInstalledError(Exception):
|
||||||
"""App not present in user's libraryfolders"""
|
"""App not present in user's libraryfolders"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AppMovedError(Exception):
|
class AppMovedError(Exception):
|
||||||
"""VDF points to a nonexistent location on disk"""
|
"""VDF points to a nonexistent location on disk"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class VDFLoadError(Exception):
|
class VDFLoadError(Exception):
|
||||||
"""Malformed VDF or JSON conversion"""
|
"""Malformed VDF or JSON conversion"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -307,8 +309,7 @@ def get_running_app() -> int | None:
|
|||||||
PROC_NAME = "steam"
|
PROC_NAME = "steam"
|
||||||
SUBPROC_NAME = "reaper"
|
SUBPROC_NAME = "reaper"
|
||||||
FLAG = "AppId"
|
FLAG = "AppId"
|
||||||
# NOTE: may cause conflicts if multiple apps are running
|
|
||||||
try:
|
|
||||||
for proc in psutil.process_iter():
|
for proc in psutil.process_iter():
|
||||||
if proc.name() == PROC_NAME:
|
if proc.name() == PROC_NAME:
|
||||||
subprocs = proc.children()
|
subprocs = proc.children()
|
||||||
@ -323,8 +324,6 @@ def get_running_app() -> int | None:
|
|||||||
return int(next(appid).split("=")[1])
|
return int(next(appid).split("=")[1])
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
return None
|
return None
|
||||||
except Exception as e:
|
|
||||||
logger.debug(e)
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@ -369,16 +368,8 @@ def get_client_allows_downloads(path: Path) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def is_dayz_running() -> bool:
|
def is_dayz_running() -> bool:
|
||||||
"""Subprocesses spawned from Steam will not show up in regular process tree"""
|
appid = get_running_app()
|
||||||
procs = []
|
return appid in (APPID_DAYZ, APPID_DAYZ_EXP)
|
||||||
substring = DAYZ_BINARY
|
|
||||||
for proc in psutil.process_iter():
|
|
||||||
try:
|
|
||||||
procs.append(proc.cmdline())
|
|
||||||
except Exception as e:
|
|
||||||
logger.warning(e)
|
|
||||||
continue
|
|
||||||
return any(substring in item for sublist in procs for item in sublist)
|
|
||||||
|
|
||||||
|
|
||||||
def get_app_path(folders_path: Path, appid: int) -> Path:
|
def get_app_path(folders_path: Path, appid: int) -> Path:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user