""" Utility functions shared across the application """ import os import json def load_settings(file_path): """Load settings from a JSON file""" try: with open(file_path, 'r', encoding='utf-8') as f: return json.load(f) except FileNotFoundError: return {} except json.JSONDecodeError: return {} def save_settings(file_path, data): """Save settings to a JSON file""" os.makedirs(os.path.dirname(file_path), exist_ok=True) with open(file_path, 'w', encoding='utf-8') as f: json.dump(data, f, indent=2, ensure_ascii=False)