diff --git a/nodes/progress_reporter.py b/nodes/progress_reporter.py index ae8f980..9bff1a6 100644 --- a/nodes/progress_reporter.py +++ b/nodes/progress_reporter.py @@ -16,7 +16,28 @@ except ImportError: HAS_REQUESTS = False VIEWER_URL = "http://127.0.0.1:3001/api/comfy-progress" -PREVIEW_DIR = r"C:\Users\rober\Playground\Viewer\public\previews" + +# The Viewer serves previews from /public/previews. This pointed at +# Playground\Viewer for a long time - the app actually lives at Playground\Apps\Viewer - +# so the clear-on-workflow-start below was sweeping an empty folder while real previews +# accumulated untouched in the served one. First existing candidate wins, so moving the +# app again does not silently resurrect that. +_PREVIEW_CANDIDATES = [ + os.environ.get("RM_PREVIEW_DIR", ""), + r"C:\Users\rober\Playground\Apps\Viewer\public\previews", + r"C:\Users\rober\Playground\Viewer\public\previews", +] + + +def _resolve_preview_dir(): + for candidate in _PREVIEW_CANDIDATES: + if candidate and os.path.isdir(candidate): + return candidate + # Nothing exists yet: prefer the current app location rather than the legacy one. + return _PREVIEW_CANDIDATES[1] + + +PREVIEW_DIR = _resolve_preview_dir() def ensure_preview_dir():