"""Sicherheits-Not-Aus für CoinPoker-Aktionen. Verwaltet die Stopp-Dateien über alle relevanten Pfade des Repositories und verhindert Klick-Aktionen bei aktivem Not-Aus. """ import os _w = os.path.dirname(os.path.abspath(__file__)) while _w != "/" and not os.path.isdir(os.path.join(_w, "hand")): _w = os.path.dirname(_w) WURZEL = _w STOPP_PFADE = [ os.path.join(WURZEL, "scratch", "stop"), os.path.join(WURZEL, "hand", "scratch", "stop"), os.path.join(WURZEL, "betrieb", "scratch", "stop"), ] def ist_gestoppt(): """Prüft, ob an mindestens einem Stopp-Pfad eine Not-Aus-Datei existiert.""" return any(os.path.exists(p) for p in STOPP_PFADE) def stopp_setzen(): """Legt an allen Stopp-Pfaden die Not-Aus-Datei an.""" for p in STOPP_PFADE: os.makedirs(os.path.dirname(p), exist_ok=True) try: with open(p, "w", encoding="utf-8") as f: f.write("not-aus") except OSError: pass def stopp_aufheben(): """Entfernt alle Not-Aus-Dateien.""" for p in STOPP_PFADE: if os.path.exists(p): try: os.remove(p) except OSError: pass