windows igen

This commit is contained in:
2026-04-12 12:15:48 +02:00
parent 564122df0a
commit 358aeca7c8
2 changed files with 19 additions and 3 deletions

View File

@@ -368,13 +368,19 @@ class LibraryWatcher:
except Exception as e:
logger.error(f"Scan fejl: {library_path}: {e}")
def _path_accessible(self, path: Path, timeout_sec: float = 5.0) -> bool:
def _path_accessible(self, path: Path, timeout_sec: float = 8.0) -> bool:
"""Tjek om en sti er tilgængelig inden for timeout."""
import threading
result = [False]
def check():
try:
result[0] = path.exists() and path.is_dir()
import os, sys
p = str(path)
if sys.platform == "win32" and (p.startswith("\\\\") or p.startswith("//")):
# UNC-stier på Windows — brug listdir der fungerer bedre
os.listdir(p)
result[0] = True
else:
result[0] = path.exists() and path.is_dir()
except Exception:
result[0] = False
t = threading.Thread(target=check, daemon=True)