fix: clear error messages when prefs or patch file missing at install time

This commit is contained in:
pyr0ball 2026-05-27 15:24:02 -07:00
parent 7b2a2c498c
commit 316b9bf606

View file

@ -95,16 +95,34 @@ def choose_preset(preset: str, auto_yes: bool) -> str:
def merge_prefs(config_path: Path, preset: str) -> None: def merge_prefs(config_path: Path, preset: str) -> None:
"""Invoke merge_prefs.py to upsert the preferences patch into Inkscape's prefs.""" """Invoke merge_prefs.py to upsert the preferences patch into Inkscape's prefs."""
subprocess.run( patch_path = SCRIPT_DIR / "config/preferences-patch.xml"
[ if not patch_path.exists():
sys.executable, sys.exit(
str(SCRIPT_DIR / "scripts/merge_prefs.py"), f"✗ Installation file missing: {patch_path}\n"
"--prefs", str(config_path / "preferences.xml"), " The repo may be incomplete — try re-cloning."
"--patch", str(SCRIPT_DIR / "config/preferences-patch.xml"), )
"--preset", preset,
], prefs_path = config_path / "preferences.xml"
check=True, if not prefs_path.exists():
) print("→ No Inkscape preferences found — seeding from Illuscape defaults")
print(" (Inkscape will fill in the rest on first launch)")
try:
subprocess.run(
[
sys.executable,
str(SCRIPT_DIR / "scripts/merge_prefs.py"),
"--prefs", str(prefs_path),
"--patch", str(patch_path),
"--preset", preset,
],
check=True,
)
except subprocess.CalledProcessError:
sys.exit(
"✗ Could not merge Inkscape preferences.\n"
" Launch Inkscape once to initialise its config, then re-run this installer."
)
# ── Config file copy ────────────────────────────────────────────────────────── # ── Config file copy ──────────────────────────────────────────────────────────