Dieser Commit ist enthalten in:
Claude Project Manager
2025-08-01 23:50:28 +02:00
Commit 04585e95b6
290 geänderte Dateien mit 64086 neuen und 0 gelöschten Zeilen

70
config/paths.py Normale Datei
Datei anzeigen

@ -0,0 +1,70 @@
"""
Path Configuration - Zentrale Pfadverwaltung für Clean Architecture
"""
import os
import sys
class PathConfig:
"""Zentrale Klasse für alle Pfadkonfigurationen"""
# Basis-Verzeichnis des Projekts
if hasattr(sys, '_MEIPASS'):
# PyInstaller Bundle
BASE_DIR = sys._MEIPASS
else:
# Normal Python execution
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Hauptverzeichnisse
DATABASE_DIR = os.path.join(BASE_DIR, "database")
CONFIG_DIR = os.path.join(BASE_DIR, "config")
RESOURCES_DIR = os.path.join(BASE_DIR, "resources")
LOGS_DIR = os.path.join(BASE_DIR, "logs")
# Datenbank-Dateien
MAIN_DB = os.path.join(DATABASE_DIR, "accounts.db")
SCHEMA_V1 = os.path.join(DATABASE_DIR, "schema.sql")
SCHEMA_V2 = os.path.join(DATABASE_DIR, "schema_v2.sql")
# Resource-Verzeichnisse
ICONS_DIR = os.path.join(RESOURCES_DIR, "icons")
THEMES_DIR = os.path.join(RESOURCES_DIR, "themes")
# Log-Verzeichnisse
SCREENSHOTS_DIR = os.path.join(LOGS_DIR, "screenshots")
@classmethod
def ensure_directories(cls):
"""Stellt sicher, dass alle notwendigen Verzeichnisse existieren"""
directories = [
cls.DATABASE_DIR,
cls.CONFIG_DIR,
cls.RESOURCES_DIR,
cls.LOGS_DIR,
cls.ICONS_DIR,
cls.THEMES_DIR,
cls.SCREENSHOTS_DIR
]
for directory in directories:
os.makedirs(directory, exist_ok=True)
@classmethod
def get_icon_path(cls, icon_name: str) -> str:
"""
Gibt den vollständigen Pfad zu einem Icon zurück
Args:
icon_name: Name des Icons (ohne .svg)
Returns:
Vollständiger Pfad zum Icon
"""
return os.path.join(cls.ICONS_DIR, f"{icon_name}.svg")
@classmethod
def file_exists(cls, path: str) -> bool:
"""Prüft ob eine Datei existiert"""
return os.path.exists(path) and os.path.isfile(path)