fix: enforce preset profile engine compatibility

This commit is contained in:
James Pine
2026-03-19 19:51:53 -07:00
parent 4e0c731db8
commit 72c13fd3fc
10 changed files with 102 additions and 150 deletions
+5 -6
View File
@@ -194,6 +194,8 @@ def _resolve_relative_paths(engine, tables: set[str]) -> None:
configured data directory. If the path starts with "data/", strip that
prefix and prepend get_data_dir(). Otherwise, join the relative path
directly under get_data_dir().
directly under get_data_dir(). If the rebased path still does not exist,
fall back to resolving relative to CWD.
"""
from pathlib import Path
@@ -222,16 +224,13 @@ def _resolve_relative_paths(engine, tables: set[str]) -> None:
p = Path(path_val)
if p.is_absolute():
continue
# Try rebasing: "data/generations/abc.wav" → data_dir / "generations/abc.wav"
parts = p.parts
if parts and parts[0] == "data":
rebased = data_dir / Path(*parts[1:])
rebased = (data_dir / Path(*parts[1:])).resolve()
else:
rebased = data_dir / p
resolved = rebased.resolve()
rebased = (data_dir / p).resolve()
resolved = rebased if rebased.exists() else p.resolve()
if resolved.exists():
conn.execute(
text(f"UPDATE {table} SET {column} = :path WHERE id = :id"),