From c99cc3c18ab9281e12be334be8fc2073ed2ee13a Mon Sep 17 00:00:00 2001 From: Tobias Leuschner Date: Sat, 9 May 2026 11:06:10 +0200 Subject: [PATCH] fix: Fehlerbehandlung beim Erstellen von Verzeichnissen verbessert und Kopierstatus aktualisiert --- app.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index d4f6b75..95a0f06 100644 --- a/app.py +++ b/app.py @@ -649,7 +649,16 @@ def do_copy(src_dev, dst_dev, cfg): return rel = f.relative_to(src_path) dst_f = dst_dir / rel - dst_f.parent.mkdir(parents=True, exist_ok=True) + try: + dst_f.parent.mkdir(parents=True, exist_ok=True) + except OSError as mkdir_err: + io_errors += 1 + add_log(f'⚠ Verzeichnis nicht erstellbar ({dst_f.parent.name}): {mkdir_err}') + with copy_lock: + copy_state.update(done=i+1, + progress=int((i+1)/total*100) if total else 100, + current=str(f.name)) + continue if dst_f.exists(): if dup_mode == 'skip': @@ -794,7 +803,7 @@ def check_auto_copy(): if not cfg.get('auto_copy') or not cfg.get('source_port') or not cfg.get('dest_port'): return with copy_lock: - if copy_state['running']: + if copy_state['running'] or copy_state['error']: return devs = usb_devices() src = next((d for d in devs if d['usb_port'] == cfg['source_port']), None)