fixxed load_configs in helpers.py
This commit is contained in:
parent
39f90fc9e4
commit
02150e0e62
@ -11,13 +11,16 @@ def load_configs(config_dir='configs'):
|
||||
außer default_sounds.json (die wird separat geladen).
|
||||
"""
|
||||
configs = []
|
||||
data = json.load(f)
|
||||
if not os.path.exists(config_dir):
|
||||
logger.warning(f"Config-Verzeichnis nicht gefunden: {config_dir}")
|
||||
return configs
|
||||
|
||||
for filename in os.listdir(config_dir):
|
||||
if filename.lower().endswith('.json') and filename != 'default_sounds.json':
|
||||
if not filename.lower().endswith('.json'):
|
||||
continue
|
||||
if filename == 'default_sounds.json':
|
||||
continue # globale Sounds separat laden
|
||||
|
||||
path = os.path.join(config_dir, filename)
|
||||
try:
|
||||
with open(path, 'r', encoding='utf-8') as f:
|
||||
@ -27,6 +30,8 @@ def load_configs(config_dir='configs'):
|
||||
configs.append(data)
|
||||
except json.JSONDecodeError as e:
|
||||
logger.error(f"Ungültiges JSON in {filename}: {e}")
|
||||
except FileNotFoundError:
|
||||
logger.error(f"Datei nicht gefunden (trotz listdir): {path}")
|
||||
except Exception as e:
|
||||
logger.error(f"Fehler beim Laden von {filename}: {e}")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user