Moved from YourlifeisGame/Spritegenerator; projects are found via _bootstrap.py (cwd or --project) and provide config.py plus list modules. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
22 lines
856 B
Python
22 lines
856 B
Python
"""
|
|
Projektordner finden, bevor ein ComfyGen-Werkzeug etwas importiert.
|
|
|
|
Ein Projekt ist ein Ordner mit config.py (Pfade, Modelle) und den Listen des Spiels
|
|
(prompts_*.py, audio_*.py, video_*.py, portraits_*.py, vintage_*.py, voice_*.py).
|
|
Gesucht wird: --project <ordner>, sonst das aktuelle Verzeichnis.
|
|
"""
|
|
import os
|
|
import sys
|
|
|
|
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
PROJECT_DIR = os.getcwd()
|
|
if "--project" in sys.argv:
|
|
i = sys.argv.index("--project")
|
|
PROJECT_DIR = os.path.abspath(sys.argv[i + 1])
|
|
del sys.argv[i:i + 2]
|
|
if not os.path.isfile(os.path.join(PROJECT_DIR, "config.py")):
|
|
sys.exit(f"ComfyGen: kein Projekt in {PROJECT_DIR} (dort fehlt config.py). "
|
|
f"Im Generator-Ordner des Projekts starten oder --project <ordner> angeben.")
|
|
if PROJECT_DIR not in sys.path:
|
|
sys.path.insert(0, PROJECT_DIR)
|