From 498b4d331151d348e7e473c9d5d7dbf9cf910cc4 Mon Sep 17 00:00:00 2001 From: MennaEzzelarab Date: Sat, 28 Mar 2026 19:48:22 +0200 Subject: [PATCH] Fix: Hardcoded Configuration File Path --- load_config.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/load_config.py b/load_config.py index 9ea2f5b..9398731 100644 --- a/load_config.py +++ b/load_config.py @@ -20,12 +20,20 @@ import json import os -CONFIG_PATH = os.path.join(os.path.dirname(__file__), 'config_template.json') +TEMPLATE_PATH = os.path.join(os.path.dirname(__file__), 'config_template.json') +CONFIG_PATH = os.path.join(os.path.dirname(__file__), 'config.json') def load_config(config_path=CONFIG_PATH): """Load the configuration JSON file.""" + + #Fallback to template if config.json doesn't exist + if not os.path.exists(config_path): + config_path = TEMPLATE_PATH + with open(config_path, 'r') as f: - return json.load(f) + config = json.load(f) + + return config def get_image_path(config, index=0): """Get the full path to an image file by index."""