更好的方法去获取output目录

This commit is contained in:
JaQuan
2025-06-15 22:08:16 +08:00
parent 1e8fc9dcd4
commit 15e2fbef43
+2 -10
View File
@@ -13,22 +13,14 @@ import traceback
from io import BytesIO
import re
import tempfile
import folder_paths
print("--- [AIIA] Loading Media Browser API Endpoints (V19 - Robustness Fixes) ---")
# --- START OF FIX: Path and Cache Logic Refinement ---
try:
# Attempt to find the ComfyUI root directory robustly
comfyui_root_path = Path(__file__).resolve().parents[2]
if not (comfyui_root_path / "main.py").exists():
current_dir = Path(__file__).resolve().parent
while not (current_dir / "main.py").exists() and current_dir != current_dir.parent:
current_dir = current_dir.parent
if (current_dir / "main.py").exists():
comfyui_root_path = current_dir
else:
raise FileNotFoundError("Could not find ComfyUI root directory.")
output_dir = comfyui_root_path / "output"
output_dir = Path(folder_paths.get_output_directory())
print(f"--- [AIIA] Successfully located ComfyUI root. Output directory set to: {output_dir}")
except Exception as e: