Release SyncVito 1.0.14

This commit is contained in:
Davito committed 2026-09-29 04:53:04 +02:00
1 parent cdcd03d7b0
commit 1d0b1b2d38
6 files changed
+139 -15

No files matched your search

+30 -8
View File
@@ -82,8 +82,8 @@ class SyncTask:
raise ValueError("Bitte einen Namen für die Aufgabe eingeben.")
if not self.source.strip() or not self.target.strip():
raise ValueError("Quell- und Zielordner müssen angegeben werden.")
source = Path(self.source).expanduser().resolve(strict=False)
target = Path(self.target).expanduser().resolve(strict=False)
source = _safe_resolve(Path(self.source).expanduser())
target = _safe_resolve(Path(self.target).expanduser())
source_norm = os.path.normcase(str(source))
target_norm = os.path.normcase(str(target))
if source_norm == target_norm:
@@ -123,7 +123,10 @@ class SyncTask:
enabled=bool(data.get("enabled", True)),
last_run=data.get("last_run"),
)
task.validate()
try:
task.validate()
except ValueError:
task.enabled = False
return task
@@ -191,12 +194,28 @@ class AppConfig:
@classmethod
def from_dict(cls, data: dict[str, Any]) -> AppConfig:
"""Erzeugt eine vollständige Konfiguration aus JSON-Daten."""
tasks: list[SyncTask] = []
for item in data.get("tasks", []):
if not isinstance(item, dict):
continue
try:
tasks.append(SyncTask.from_dict(item))
except Exception:
continue
return cls(
tasks=[SyncTask.from_dict(item) for item in data.get("tasks", [])],
tasks=tasks,
settings=AppSettings.from_dict(data.get("settings", {})),
)
def _safe_resolve(path: Path) -> Path:
"""Löst Pfade sicher auf; fängt Netzwerkfehler und unvollständige Pfade ab."""
try:
return path.resolve(strict=False)
except OSError:
return path.absolute()
def _normalize_relative_path(value: str) -> str:
normalized = value.replace("/", os.sep).replace("\\", os.sep).strip(os.sep)
path = Path(normalized)
@@ -207,7 +226,10 @@ def _normalize_relative_path(value: str) -> str:
def _is_relative_to(path: Path, base: Path) -> bool:
try:
path.relative_to(base)
except ValueError:
return False
return True
return path.is_relative_to(base)
except (ValueError, OSError, AttributeError):
try:
path.relative_to(base)
return True
except ValueError:
return False