diff --git a/install.py b/install.py index dae54b9..6f295e3 100644 --- a/install.py +++ b/install.py @@ -95,16 +95,34 @@ def choose_preset(preset: str, auto_yes: bool) -> str: def merge_prefs(config_path: Path, preset: str) -> None: """Invoke merge_prefs.py to upsert the preferences patch into Inkscape's prefs.""" - subprocess.run( - [ - sys.executable, - str(SCRIPT_DIR / "scripts/merge_prefs.py"), - "--prefs", str(config_path / "preferences.xml"), - "--patch", str(SCRIPT_DIR / "config/preferences-patch.xml"), - "--preset", preset, - ], - check=True, - ) + patch_path = SCRIPT_DIR / "config/preferences-patch.xml" + if not patch_path.exists(): + sys.exit( + f"✗ Installation file missing: {patch_path}\n" + " The repo may be incomplete — try re-cloning." + ) + + prefs_path = config_path / "preferences.xml" + 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 ──────────────────────────────────────────────────────────