fix: Fehlerbehandlung beim Erstellen von Verzeichnissen verbessert und Kopierstatus aktualisiert

This commit is contained in:
2026-05-09 11:06:10 +02:00
parent 4557e8af89
commit c99cc3c18a

11
app.py
View File

@@ -649,7 +649,16 @@ def do_copy(src_dev, dst_dev, cfg):
return return
rel = f.relative_to(src_path) rel = f.relative_to(src_path)
dst_f = dst_dir / rel dst_f = dst_dir / rel
try:
dst_f.parent.mkdir(parents=True, exist_ok=True) 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 dst_f.exists():
if dup_mode == 'skip': 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'): if not cfg.get('auto_copy') or not cfg.get('source_port') or not cfg.get('dest_port'):
return return
with copy_lock: with copy_lock:
if copy_state['running']: if copy_state['running'] or copy_state['error']:
return return
devs = usb_devices() devs = usb_devices()
src = next((d for d in devs if d['usb_port'] == cfg['source_port']), None) src = next((d for d in devs if d['usb_port'] == cfg['source_port']), None)