Fix PREVIEW_DIR so preview cleanup targets the served folder
PREVIEW_DIR pointed at Playground\Viewer\public\previews, but the app lives at Playground\Apps\Viewer. The clear-on-workflow-start in styles_pipe has therefore been sweeping an empty folder since the app moved, while real previews accumulated untouched in the served one - 9 files / 4.26 MB found and removed. Resolves against a candidate list now (RM_PREVIEW_DIR, current location, legacy), first existing wins, so moving the app again cannot silently resurrect this. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012uM7Ru1JYn48n6c5Rzwd99
This commit is contained in:
co-authored by
Claude Opus 5
parent
8273fc52eb
commit
121670e72e
@@ -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 <app>/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():
|
||||
|
||||
Reference in New Issue
Block a user