added config file and parser

This commit is contained in:
Mikhail Tergoev 2025-03-07 01:55:38 +03:00
parent ce9feceb52
commit 3a57048f49
2 changed files with 21 additions and 0 deletions

7
config.json Normal file

@ -0,0 +1,7 @@
{
"plugins_ver" : "20",
"libs_ver" : "52",
"used_wine" : "PROTON_LG",
"default_wine" : "WINE_LG_10-1",
"default_proton" : "PROTON_LG_9-19"
}

14
modules/config_parser.py Normal file

@ -0,0 +1,14 @@
import json
from .log import *
from .env_var import *
def var(var_name):
py_work_path = get_env_var("PYTHON_WORK_PATH")
# Читаем конфигурационный файл
with open(py_work_path + "/config.json", "r") as file:
config = json.load(file)
if config[var_name]:
return config[var_name]
else:
log.critical(f"в config.json нет значения переменной: {var_name}")