fix: clear error messages when prefs or patch file missing at install time
This commit is contained in:
parent
7b2a2c498c
commit
316b9bf606
1 changed files with 28 additions and 10 deletions
38
install.py
38
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 ──────────────────────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Reference in a new issue