package runner import ( "os" "path/filepath" ) // ClearAECrashState removes After Effects' session crash-recovery marker // (SCRPriorState.json) from every AE prefs version dir. AE checks this file at // startup; if it indicates an unclean prior session it shows the blocking // "Crash Repair Options" dialog — which would hang a headless afterfx/aerender // launch. Deleting it (vs. wiping all prefs) keeps the node's prefs intact. // // Safe no-op when APPDATA is unset (non-Windows / dev). func ClearAECrashState() { appData := os.Getenv("APPDATA") if appData == "" { return } base := filepath.Join(appData, "Adobe", "After Effects") entries, err := os.ReadDir(base) if err != nil { return } for _, e := range entries { if e.IsDir() { _ = os.Remove(filepath.Join(base, e.Name(), "SCRPriorState.json")) } } }