mirror of
https://github.com/aclist/dztui.git
synced 2026-08-28 02:37:20 +02:00
26 lines
638 B
Python
26 lines
638 B
Python
import logging
|
|
import shutil
|
|
import subprocess
|
|
|
|
from dzgui.const.constants import APP_NAME, FLATPAK_APPID, FLATPAK_CMD, STEAM_CMD
|
|
|
|
logger = logging.getLogger(APP_NAME)
|
|
|
|
|
|
def has_steam_client() -> bool:
|
|
if shutil.which(STEAM_CMD):
|
|
return True
|
|
if not shutil.which(FLATPAK_CMD):
|
|
return False
|
|
try:
|
|
res = subprocess.run(
|
|
[FLATPAK_CMD, "list"], capture_output=True, text=True, check=True
|
|
)
|
|
if FLATPAK_APPID in res.stdout:
|
|
return True
|
|
else:
|
|
return False
|
|
except subprocess.CalledProcessError as e:
|
|
logger.critical(e)
|
|
return False
|